home *** CD-ROM | disk | FTP | other *** search
/ Belgian Amiga Club - ADF Collection / BS1 part 05.zip / BS1 part 5 / Empty.adf / SuperBaseFormEd.doc < prev    next >
Text File  |  1992-02-07  |  123KB  |  2,759 lines

  1.             SUPERBASE PROFESSIONAL
  2.                  FORMS EDITOR
  3.                  USER GUIDE
  4.  
  5.     FORMS EDITOR USER GUIDE   CONTENTS
  6.  
  7. CHAPTER 1
  8. INTRODUCTION                        1-1
  9. The Forms Editor                    1-1
  10. How to Use This Guide                    1-2
  11.  
  12. CHAPTER 2
  13. GETTING STARTED                        2-1
  14. Introduction                        2-1
  15. Basic Concepts                        2-1
  16.   Forms and Pages                    2-1
  17.   Objects                        2-2
  18.   Fields                        2-3
  19. Menus and Dialogs                    2-3
  20.   Using Dialogs                        2-4
  21.   Ghosted Items                        2-5
  22. Working with Forms                    2-5
  23.   Creating a New Form                    2-5
  24.   Creating a New Page                    2-5
  25.   Opening a Form                    2-5
  26.   Opening a Page                    2-6
  27.   Changing the Current Page                2-7
  28.   Saving a Form                        2-7
  29.   Saving a Page                        2-7
  30. A Sample Session                    2-8
  31. Housekeeping                        2-9
  32.   Directories and Subdirectories            2-9
  33.   Changing the Directory                2-10
  34.   Status                        2-10
  35.   Removing Forms and Pages                2-11
  36. Resolution (Amiga only)                    2-11
  37.  
  38. CHAPTER 3
  39. DESIGNING A PAGE                    3-1
  40. Design Tools                        3-1
  41.   Overview                        3-1
  42.   Note                            3-2
  43.  
  44.                 i
  45.  
  46.   Cancelling an Operation                3-2
  47.   Summary                        3-2
  48.   Fields                        3-3
  49.   Field Options                        3-3
  50.   Lines                            3-4
  51.   Boxes                            3-4
  52.   Areas                            3-4
  53.   Text                            3-4
  54.   Images                        3-5
  55. Attributes                        3-6
  56.   The Attributes Window                    3-6
  57.   Pen/Paper Selector                    3-7
  58.   Pen                            3-8
  59.   Pen and Paper                        3-8
  60.   Colour Palette                                        3-9
  61.   Object Print Status                                   3-9
  62.   Text Styles                                           3-10
  63.   Field Justification                                   3-10
  64.   Read Only                                             3-10
  65.   Area Patterns                                         3-11
  66.   Line Thickness                                        3-11
  67. Text Fonts                                              3-11
  68. Crosshairs                                              3-12
  69. Align                                                   3-12
  70. Reduce                                                  3-13
  71.  
  72. CHAPTER 4
  73. EDITING FORMS                                           4-1
  74. Hierarchy of Objects                                    4-1
  75. Selecting Objects                                       4-2
  76. Editing a Page                                          4-2
  77.   Undo                                                  4-3
  78.   Clear                                                 4-3
  79.   The Clipboard                                         4-3
  80.   Cut                                                   4-3
  81.   Copy                                                  4-4
  82.   Paste                                                 4-4
  83.   Move                                                  4-4
  84.   Moving a Group of Objects                             4-5
  85.   Size                                                  4-5
  86. Editing Attributes                                      4-5
  87. Editing Text                                            4-6
  88.  
  89.                 ii
  90.  
  91. Changing Pages                                          4-6
  92.   To Front                                              4-7
  93.   Swap                                                  4-7
  94.   Cut                                                   4-7
  95.  
  96. CHAPTER 5
  97. FORMS, FIELDS AND FILES                                 5-1
  98. Calculation                                             5-1
  99.   Using Report Functions in Calculations                5-2
  100. Validation                                              5-3
  101. Replicating Fields                                      5-3
  102. Setting the Field Order                                 5-3
  103. Linking Files                                           5-5
  104.   Using the Link Option                                 5-5
  105.   A Two File Example                                    5-5
  106.   Linking More than Two Files                           5-6
  107.   Editing Existing Links                                5-7
  108.   Limits of the Linking Capability                      5-7
  109.  
  110. CHAPTER 6
  111. PRINTING FORMS                                          6-1
  112.   Printing a page                                       6-1
  113. Print Options                                           6-1
  114.   Draft Printing                                        6-2
  115.   Graphics Printing                                     6-2
  116.   Print Zones                                           6-3
  117.   Object Print Status                                   6-3
  118.  
  119. CHAPTER 7
  120. GENERATING REPORTS                                      7-1
  121.   Overview                                              7-1
  122.   A Note on Graphics and Text                           7-1
  123. Creating a Report: Step by Step                         7-2
  124.   Preparation                                           7-2
  125.   Selecting Fields to be Printed                        7-2
  126.   Specifying a Report Heading                           7-2
  127.   Specifying a Report Footing                           7-3
  128.   Groups                                                7-3
  129.   Specifying a Group                                    7-3
  130.   The BEFORE GROUP Box                                  7-4
  131.  
  132.                 iii
  133.  
  134.   The AFTER GROUP Box                                   7-4
  135.   Multiple Groups                                       7-5
  136.   Specifying Report Functions                           7-5
  137. The Report Filter                                       7-5
  138. Sorting                                                 7-6
  139. Saving the Report Form                                  7-6
  140. Refining Your Report                                    7-6
  141.   Title Page                                            7-6
  142.   Totals Page                                           7-6
  143.   Summary Reports                                       7-6
  144.   Page On Group                                         7-7
  145.  
  146. CHAPTER 8
  147. USING FORMS AND REPORTS                    8-1
  148. Opening a Form                                          8-1
  149.   Single File Forms                                     8-1
  150.   Multiple File Forms                                   8-2
  151. Browsing with a Form                                    8-2
  152. Current Record/Page Selector                            8-3
  153.   Change Index                                          8-3
  154.   Temporarily Changing the Master File                  8-3
  155.   Lookup                                                8-4
  156.   Filters                                               8-4
  157. Switching to the Default Views                          8-4
  158.   Reselecting the Form                                  8-5
  159. Data Entry and Editing                                  8-5
  160.   Field Entry Order                                     8-5
  161.   Data Entry: Record New                                8-6
  162.   Committing the Form: Record Save                      8-6
  163.   Batch Data Entry                                      8-7
  164.   Editing a Form                                        8-7
  165.   Snapshot Data Entry: Record Duplicate                 8-7
  166.   Removing Form Data: Record Remove                     8-8
  167. Reports                                                 8-8
  168.   Running a Report                                      8-8
  169.   Adding Filter Conditions                              8-8
  170.   Adding Order Conditions                               8-9
  171.   Print/Display Option                                  8-9
  172.   Modifying a Report Program                            8-10
  173.   Output device                                         8-10
  174.   Filter and Order                                      8-10
  175. Forms and the Project Menu                              8-10
  176.  
  177.                 iv
  178.  
  179.   Open Fields                                           8-10
  180.   Close Form                                            8-10
  181.   Edit File                                             8-11
  182.   Remove File or Index                                  8-11
  183.  
  184.                 v
  185.  
  186.              CHAPTER 1 - INTRODUCTION
  187.  
  188. THE FORMS EDITOR
  189. Superbase Professional's Forms Editor can be treated as three program in
  190. one, each of them equally useful and each complementary to the others.
  191.  
  192. First, the Forms Editor acts as a front end to Superbase Professional. You
  193. can design a form around a particular file and then use it both to display
  194. the file's data on screen and to enter new data. When it is used in this
  195. way, the Forms Editor provides a similar facility (only considerably more
  196. powerful) to Superbase's Form View option.
  197.  
  198. More important than this single file facility is the way it simplifies the
  199. task of relating data from different files. Here the Forms Editor acts as
  200. an intelligent front end which can handle and process the data from
  201. multiple Superbase files. A form can be set up to display fields or records
  202. from two or three (or more) files at the same time.
  203.  
  204. For data entry, you could design a form to store each line in a separate
  205. field, or in a separate record, or even in a separate file. Using Superbase
  206. functions such as Lookup, you can build cross-file validation and
  207. calculation into a form, so that it checks new data against records in
  208. other files. Another of the program's facilities lets you specify the order
  209. in which data is entered in a form.
  210.  
  211. Alongside this, the Forms Editor serves as a fully fledged design and
  212. drawing package. In this capacity it allows you to create multi-page forms,
  213. combining colour, lines, boxes, and text as you please. An extensive set of
  214. editing facilities then enables you to alter almost any feature on a page
  215. with just a few clicks on the mouse. There is also an option for
  216. integrating graphic images - company logos or letterheads, for example -
  217. created in other programs. Once a form has been designed, it can be printed
  218. out, photocopied and used for everyday business purposes.
  219.  
  220. Business, in fact, will probably be the area where the program finds the
  221. widest application - for invoices, order forms, expense forms, stock
  222. control, marketing questionnaires, etc. - but it is just as suitable for
  223. producing the kind of forms used in many other areas such as research and
  224. education.
  225.  
  226. The Forms Editor's third role is as a report generator. Superbase
  227. Professional already includes a report facility, but the Forms Editor
  228. supplements this with a greater range of report formatting and report
  229. analysis features. Here again, it 
  230.  
  231.                 1-1
  232.  
  233. is as easy to extract and summarize data from multiple files as it is from
  234. single files. Then you can lay out the elements on your report with far
  235. greater flexibility than before. You can also produce multi-page reports
  236. with separate title and totals pages.
  237.  
  238. HOW TO USE THIS GUIDE
  239. Chapter 2, Getting Started, is intended to provide a quick guide to the
  240. Forms Editor. It takes you up to the point where you can open a new form,
  241. design a page, save it on disk, and then load it back in to be edited. At
  242. the same time, it introduces you to the handful of basic concepts that you
  243. will need before you can feel fully at home with the Forms Editor. This
  244. chapter, then, is the only one that needs to be read from start to finish.
  245. The other chapters can be treated as reference material - to be consulted
  246. only when you need additional information on a particular topic.
  247.  
  248. Chapter 3, Designing a Form, describes the options which the Forms Editor
  249. provides for designing a form. These are the tools you will use to add
  250. fields,  text and graphics to a page.
  251.  
  252. Chapter 4, Editing a Form, explains how to modify a form after it has been
  253. created.
  254.  
  255. Chapter 5, Fields and Forms, covers the more advanced options associated
  256. with adding fields to a form. These include Calculation, Validation, and
  257. setting the field order.
  258.  
  259. Chapter 6, Printing a Form, explains how to print a form, and describes the
  260. various print options.
  261.  
  262. Chapter 7, Generating Reports, shows you how to create a form which will
  263. produce a report when it is loaded into Superbase.
  264.  
  265. Chapter 8, Using Forms and Reports, describes the various ways in which you
  266. can use forms in Superbase for entering or retrieving data and for
  267. producing reports.
  268.  
  269.                 1-2
  270.  
  271.                 CHAPTER 2 - GETTING STARTED
  272.  
  273. INTRODUCTION
  274. You should find the Forms Editor easy to use, especially if you are already
  275. familiar with Superbase itself. However, there are several concepts that
  276. are crucial to understanding the way the Forms Editor works. If you have a
  277. clear idea of these, it will make the task of mastering the Forms Editor
  278. that much easier. The first part of this chapter explains these basic
  279. concepts.
  280.  
  281. The second section, Forms and Pages, describes how to open forms and pages,
  282. how to create new forms and pages, and how to save them on disk. By taking
  283. you through a sample session, it then shows you how to design a simple one
  284. page form.
  285.  
  286. In the last section, Housekeeping, we describe the facilities which are
  287. provided by the Forms Editor for handling the files you create on disk.
  288.  
  289. BASIC CONCEPTS
  290. FORMS AND PAGES
  291. So far we have used the term 'form' in its usual sense where it covers a
  292. wide range of different kinds of printed material: invoices, data entry
  293. forms, customer receipts, and so on. However, in this manual and in the
  294. program itself (on menus and dialogs) the term 'form' also has a more
  295. precise sense, in which a form means a collection of 'pages'.
  296.  
  297. A single page measures 240 characters across by 66 lines. On the screen,
  298. you can only see part of a page, but you can scroll around it using the
  299. scroll bars. You can things of a page as three A4 sheets laid together side
  300. by side; each sheet can contain 66 lines of 80 characters. When you come to
  301. print out a page, you have a choice of printing any one of these three
  302. sheets.
  303.  
  304. The main advantage of making a distinction between forms and pages is
  305. flexibility. It means that you can design and save pages on their own, and
  306. then build up a form from different pages. You can use the same page or
  307. pages in different forms, and you can repeat the same page in a single
  308. form. You can even edit a form by altering the page order or deleting and
  309. inserting pages.
  310.  
  311.                 2-1
  312.  
  313. The points raised in this section can be summarized by four rules relating
  314. to forms and pages:
  315.  
  316. 1. A form may consist of a single page or multiple pages.
  317. 2. A form consisting of only one page can be saved either as a form or as a
  318.    page.
  319. 3. A form consisting of more than one page can only be saved as a form.
  320. 4. You cannot load another form into your current form, but you can load a
  321.    page into your current form.
  322.  
  323. Note also that a saved form is identified by the extension '.sbv', while a
  324. page is identified by the extension '.pg'.
  325.  
  326. OBJECTS
  327. Whenever you add something to a page, whether text or graphics, the Forms
  328. Editor identifies it as an 'object'. A line, a box, a field, a line of
  329. text, an area, an image - each of these is treated as a separate object. In
  330. this way, the program keeps track of all the elements that make up a page.
  331. As such, it contrasts with other drawing and design packages that allow you
  332. to build up an image on screen but do not keep the details of the separate
  333. components of an image.
  334.  
  335. Taking an 'object-oriented' approach has several advantages, particularly
  336. when you want to edit a page. It makes it easy to select any part of a page
  337. and alter it, for example by moving it to a new position or resizing it.
  338. Another advantage is that you can instruct the Forms Editor to print out
  339. only certain types of object - to leave out the text on a page, for
  340. example, or to ignore any shaded areas.
  341.  
  342. The Forms Editor recognizes six types of object:
  343.  
  344.     Areas
  345.     Boxes
  346.     Lines
  347.     Images 
  348.     Text
  349.     Fields
  350.  
  351. Apart from areas and images, it should be clear what each of these types
  352. represents. Thus a line is a straight line, and a box is a rectangular box.
  353. Areas are filled boxes; that is, boxes which have been filled with the same
  354. colour and pattern as the lines that make up their sides. Images are
  355. pictures
  356.  
  357.                 2-2
  358.  
  359. which have been created by another program such as Gem Paint, and then
  360. imported into a Forms Editor page.
  361.  
  362. Generally, each distinct element on screen forms a separate object. So, a
  363. line of text or a graphics line is usually a single object. But it is
  364. perfectly possible to construct a line (or any other item on screen) from
  365. several objects; you can make a long line from a number of short lines
  366. joined together.
  367.  
  368. What actually defines something as an object is the fact that it is created
  369. in one operation. In other words, pressing the mouse button after drawing a
  370. line defines it as a single object; similarly, pressing the Return key
  371. after typing something in means that it will be treated as a text object.
  372.  
  373. At this stage, you will find it helpful if you start thinking of a Forms
  374. Editor page as a collection of different types of objects. Chapter 3
  375. describes the options for adding objects to page. Chapter 4 explains how to
  376. select objects in order to modify them or reorganize them on the page.
  377.  
  378. FIELDS
  379. Fields provide the link between the Forms Editor and Superbase.
  380.  
  381. These are the elements that enable you to use a form within Superbase,
  382. either for entering data in a file or for retrieving data. By attaching
  383. calculation and validation formulae to fields, you can give a form its own
  384. data processing capability. Working together, these features allows you to
  385. build relational links between different files into a form; or to set up a
  386. form that calculates results automatically as soon as data is entered in a
  387. field.
  388.  
  389. Although fields are treated as objects in the same way as lines or text,
  390. there are two important differences. First, a field must already exist in a
  391. Superbase file before it can be added to a form. Second, the contents of a
  392. field are not shown on screen until it is used within Superbase; instead,
  393. the Forms Editor draws a field box where the contents will appear. When you
  394. come to use the form from Superbase, the field will either show the
  395. contents of a particular record,  or it will be blank, ready for data
  396. entry.
  397.  
  398. MENUS AND DIALOGS
  399. The Forms Editor functions and controls are available from five menus.
  400. These work in the same way as other Superbase menus: to display (or pull
  401. down) a menu, move the mouse pointer over the menu heading on the bar at
  402. the top of the screen (On the Amiga, click the right mouse button to
  403. display the menu bar). The Forms Editor will then display the menu
  404. associated with the heading.
  405.  
  406.                 2-3
  407.  
  408. On Gem versions, you can select an item on the menu by moving the pointer
  409. over it and clicking on the left mouse button. As you do this, the Forms
  410. Editor highlights the item and, once you have clicked the mouse button,
  411. withdraws the menu. If you want to de-select a menu, move the pointer away
  412. from the menu bar and click the mouse button.
  413.  
  414. On the Amiga, you select an item by highlighting it with the pointer and
  415. then releasing the right mouse button.
  416.  
  417. When you select certain items such as Attributes on the Edit menu or Open
  418. Page on the Project menu, you will be presented with another menu or a
  419. dialog, which gives you a further set of items to choose from.
  420.  
  421. USING DIALOGS
  422. Almost all the Forms Editor dialogs include a choice of some kind, and
  423. require you to select an item.
  424.  
  425. Some dialogs show a panel that contains a list of names such as file names
  426. or directory names. There are two ways of selecting a name:
  427.  
  428. Click once on the name to place it in the Selection Box. Then click on OK.
  429. With some dialogs you may be able to press Return instead of clicking on
  430. OK. Double click on the name.
  431.  
  432. As a further alternative, you can also type the name directly into the
  433. Selection Box.
  434.  
  435. The dialog panel may be only a few lines long, so there may be more files
  436. then can be shown at one time. If there's a gap at the bottom of the scroll
  437. bar there are more items to be viewed. You can show them by dragging down
  438. the scroll bar at the right of the panel, or by clicking on the downwards
  439. pointing arrow gadget below the scroll bar.
  440.  
  441. One very important fact about dialogs is that you must respond to them
  442. before you can do anything else. Most dialogs have a Cancel button.
  443. Clicking on this returns you to whatever you were doing previously. If
  444. there's no Cancel button there is certain to be an OK button, and you can
  445. safely click on this once you've read the dialog.
  446.  
  447. Some dialogs include a Clear button. This has the effect of removing
  448. anything that's in the Selection Box, and can be used at any time.
  449.  
  450.                 2-4
  451.  
  452. GHOSTED ITEMS
  453. You will notice that some menu items are 'ghosted' and appear in faint
  454. script. This means that they are temporarily unavailable. usually the
  455. reason is that they require you to perform some other operation before they
  456. become available. Thus, you cannot add a field to a page if there are no
  457. fields to select, so the Fields option remains ghosted until you load a
  458. Superbase file.
  459.  
  460. Some of the font options on the Font menu may be ghosted for another
  461. reason: because they are not available to the system.
  462.  
  463. WORKING WITH FORMS
  464. CREATING A NEW FORM
  465. The New Form item on the Project Menu is used to start a new form. However,
  466. when you load the Forms Editor, the opening screen presents you with a
  467. blank untitled page. You can treat this as the first page in a new form.
  468.  
  469. New Form, therefore, only needs to be used when another form has already
  470. been opened. You may have loaded a form from disk and edited it, or you may
  471. have already created a new form and saved it on disk. If you now want to
  472. start work on a new form, you need to select this menu item in order to
  473. clear the first form from memory.
  474.  
  475. CREATING A NEW PAGE
  476. Selecting the New Page item on the Project menu inserts a blank page after
  477. the current page. For example, if the current page is Page 2, the new page
  478. will be Page 3.
  479.  
  480. Use this option when you want to add a new page to a form. It does not
  481. clear any pages that have already been opened.
  482.  
  483. When you create a new form, you will notice that the New Page menu item is
  484. ghosted. It does not become available until an object has been added to the
  485. first page in the form.
  486.  
  487. OPENING A FORM
  488. You use the Open Form item on the Project menu to load a form from disk.
  489. Select this option when you want to edit a form you have created
  490. previously, or when you want to view a form.
  491.  
  492. Selecting Open Form brings up a dialog which shows a list of the forms in
  493. the current directory. You can scroll down the list using the scroll bar at
  494. the
  495.  
  496.                 2-5
  497.  
  498. side. Once you have selected the form you want to open, you can either
  499. double click on the form name or click once on the name and then again on
  500. the OK gadget.
  501.  
  502. If a form has already been opened, it will be replaced by the form selected
  503. with Open Form. You cannot use the Open Form option to join two forms
  504. together - for this you need to use Open Page.
  505.  
  506. OPENING A PAGE
  507. The Open Page item on the Project menu opens a page that has previously
  508. been saved on disk.
  509.  
  510. Open Page works in the same way as Open Form except that it does not
  511. replace any pages that may have already been opened. Like Open Form,
  512. selecting Open Page brings up a dialog showing a list of page files on
  513. disk. But when you select a page from the list, it is inserted in the form
  514. after the current page. If you have just opened a new form, the page will
  515. be Page 1; if there are already four pages in your form and the current
  516. page is Page 3, the page you select will become Page 4. The previous Page 4
  517. will then become Page 5.
  518.  
  519. Open Page allows you to create new forms from old. Here are some of the
  520. ways this option can be used:
  521.  
  522. To load a single page so that it can then be edited. 
  523. To join two forms together. 
  524. To create a new form using the pages from other forms (or from a library of
  525.    pages). 
  526. To repeat pages.
  527.  
  528. Open Page works with pages that have been saved individually as pages (as
  529. '.pg' files), using the Save Page option. You cannot use Open Page to load
  530. pages that have been saved with the Save Form option. If you want to add
  531. the pages from one form to the pages in another, you will need to save them
  532. separately.
  533.  
  534. Note that when you save a page, it is not stored on disk with its current
  535. page number. This means that you can open the same page as many times as
  536. you wish in the same form - you can repeat pages.
  537.  
  538. Of course, it is unlikely that you will need to create a form with every
  539. page exactly the same. This feature, though, is useful for creating forms
  540. in which there are only small differences in each page. It lets you repeat
  541. a page and then edit in the differences.
  542.  
  543.                 2-6
  544.  
  545. CHANGING THE CURRENT PAGE
  546. The first three items on the Page menu - Goto, Next and Previous - enable
  547. you to change the current page. These options only work with pages that
  548. have already been opened.
  549.  
  550. Selecting Goto brings up a dialog which allows you to type in the number of
  551. another open page. When you press Return or click on OK, the Forms Editor
  552. makes the page whose number you have entered the current page and displays
  553. it in the page window.
  554.  
  555. The Next option takes you onto the next page. For example, if you have
  556. opened a form with four pages and the current page is Page 2, Next makes
  557. Page 3 the current page.
  558.  
  559. The Previous option takes you back to the previous page; if you are on Page
  560. 3, it makes Page 2 the current page.
  561.  
  562. SAVING A FORM
  563. Use the Save Form item on the Project menu to save the current form on
  564. disk. Selecting this option brings up a dialog where you can type in the
  565. form's name. If you enter the name of form which already exists, you will
  566. be asked if you want to replace the form on disk. Click on OK if you want
  567. to save a new version of the form under its old name; otherwise click on
  568. Cancel and then save the form under a new name.
  569.  
  570. This option saves all the pages in a form in their current order. If the
  571. form has only one page, it is saved as a single page form.
  572.  
  573. When Save Form stores a form on disk, it adds an '.sbv' extension to the
  574. form name.
  575.  
  576. SAVING A PAGE
  577. To save the current page on disk, select the Save Page option on the
  578. Project menu. This operates in the same way as Save Form, using a dialog.
  579.  
  580. Save Page ignores the current page's number. Once a page has been saved
  581. with this option, it can then be inserted at any point in a multiple page
  582. form (see Opening a Page).
  583.  
  584. Separate pages are stored on disk with the '.pg' extension name.
  585.  
  586.                 2-7
  587.  
  588. A SAMPLE SESSION
  589. Assuming you have just loaded the Forms Editor, your screen should look
  590. like this:
  591.  
  592.     PROJECT      PAGE     EDIT  SET  REPORT  FONT        FORM
  593.                      Untitled:  Page 1
  594.  
  595. The Forms Editor provides a number of options on the Set menu for drawing a
  596. page and adding text to a page. We refer to them here as design tools.
  597.  
  598. The Line option enables you draw straight lines. This is the default design
  599. tool, so you can start drawing a line straight away.
  600.  
  601. Position the drawing cursor (the small cross) anywhere in the display area
  602. and click the left-hand button of the mouse.
  603.  
  604. Move the pointer to the right. As you do this you will see that you have
  605. started to draw a straight dotted line from the position where you clicked
  606. the mouse, to where the cursor is currently located. Now decide where you
  607. want to draw the line to, and click the left-hand mouse button. The line
  608. will then be drawn on screen as a solid line.
  609.  
  610. Now draw a vertical line. As before, position the cursor anywhere on screen
  611. and click the mouse button. Then move the cursor down and click the mouse
  612. button a second time.
  613.  
  614. Lines can be drawn in different colours, different patterns, and with
  615. different thicknesses. These features, which are explained in Chapter 3,
  616. are known as a line's attributes. It is even possible to change a line's
  617. attributes after it has been drawn. But for the purposes of this example,
  618. we will stick to the default attributes.
  619.  
  620. You can now add other objects to the page, using the Box and Area design
  621. tools.
  622.  
  623.                 2-8
  624.  
  625. First you need to select Box from the Set menu. Move the cursor to the Set
  626. menu and click on Box. Then position the cursor somewhere in the Page
  627. window and click the left-hand button. You can now draw a box by moving the
  628. cursor down to the right. When you have drawn the box to the dimensions you
  629. want, click the left-hand button again to fix it on the page.
  630.  
  631. To draw an area, first select Area from the Set menu and then repeat the
  632. procedure for drawing a box.
  633.  
  634. Adding a field to the page is only slightly more complicated then adding a
  635. graphics object. The first step is to open a Superbase file using the Open
  636. File option on the Project menu. With a file open, select Fields from the
  637. Set menu. You will then be presented with a fields options dialog. For the
  638. time being we will ignore these options, so you should now click on OK.
  639.  
  640. This action takes you back to the page window. Position the cursor anywhere
  641. in the window and click the mouse button; another dialog will appear, this
  642. time showing a list of fields for the current file. When you select a field
  643. from the list - by doubling clicking on it, or clicking once and then again
  644. on OK - the Forms Editor will draw a field box on screen at the point where
  645. you last positioned the cursor.
  646.  
  647. There is no practical limit to the number of objects you can add to a page.
  648. You may now like to carry on with the same page, or you can clear the page
  649. - using the Clear option on the Page menu - and start again. At any point
  650. you can store your page on disk, using Save Page from the Project menu.
  651.  
  652. This section, however, is only intended to get you started on the process
  653. of designing a form. The next chapter covers the design tools in more
  654. detail.
  655.  
  656. HOUSEKEEPING
  657. Housekeeping covers a variety of different topics: looking at the disk
  658. directory,  changing the directory, removing forms from disk, and removing
  659. pages. Although these operations do not have a direct bearing on the task
  660. of creating a form, they need to be explained early on. As your disk fills
  661. up with more and more Forms Editor files, you will appreciate the
  662. importance of organizing them properly. It is as well to start off as you
  663. mean to continue.
  664.  
  665. DIRECTORIES AND SUBDIRECTORIES
  666. If you are running the Forms Editor on a hard disk machine, it is a good
  667. idea to store forms and pages in a separate directory from the program
  668. itself. You
  669.  
  670.                 2-9
  671.  
  672. may want to create several subdirectories; for example, one for Superbase
  673. files and one for forms and pages. But if you intend to use a form for
  674. displaying Superbase data, it should be in the same directory as the
  675. Superbase file. Your operating system manual will tell you how to create a
  676. subdirectory. This needs to be done before you load the Forms Editor.
  677.  
  678. If you have a floppy disk system, you are recommended to create a data disk
  679. for storing pages and forms separately from the program itself. Remember
  680. that you will have to format a blank disk before using it as a data disk.
  681.  
  682. CHANGING THE DIRECTORY
  683. Within the Forms Editor you can change the current directory and the
  684. current drive using the Directory option on the Project menu. Directory
  685. displays a dialog which lists all the directories below the current level;
  686. i.e. if you are already at the bottom of the directory tree, the dialog
  687. will be empty.
  688.  
  689. You can select a directory from the list in the usual way by clicking on OK
  690. or double clicking. Selecting '..' ('/') takes you to the next level up the
  691. directory tree. 
  692.  
  693. If you want to change to a directory in another branch of the tree, you
  694. will need to type in its name and pathname. For example, if you had a
  695. directory called Images, which was a subdirectory of SBforms, typing
  696.  
  697. \SBforms\Images
  698.  
  699. /SBforms/Images would make Images the current directory.
  700.  
  701. To change to another drive, type in the drive name - a:, b:, c:, or d:
  702. (DF0:, DF1:,  DH1:).
  703.  
  704. After typing in a directory name or a drive name, click on OK or press
  705. Return.
  706.  
  707. STATUS
  708. The Status option on the Project menu provides information about various
  709. aspects of the system. You can use it, for example, to find out how much
  710. memory is left, or to find out where you are in the directory tree.
  711.  
  712. Selecting Status brings up a dialog showing:
  713.  
  714. The Superbase files that have been opened.
  715.  
  716. The current directory.
  717.  
  718.                 2-10
  719.  
  720. The number of pages in the current form.
  721.  
  722. The amount of space remaining on the current disk.
  723.  
  724. The amount of free memory.
  725.  
  726. REMOVING FORMS AND PAGES
  727. Remove Form and Remove Page allow you to delete a form or a page from the
  728. disk. These options work in the same way as the equivalent operating system
  729. commands,  such as Erase in MSDOS and Delete in AmigaDOS: they delete the
  730. specified file from disk, and make the space it occupied available for
  731. further storage. Use Remove when you are running short of disk space, or
  732. simply to keep your directories tidy by deleting files that are no longer
  733. used.
  734.  
  735. RESOLUTION (AMIGA ONLY)
  736. On the Amiga, the Project menu includes a Resolution option which allows
  737. you to set the screen resolution and the number of colours. This gives you
  738. a choice of four different resolution and colour settings:
  739.  
  740.     Interlace on
  741.     4 Colours
  742.     8 Colours
  743.     16 Colours
  744.  
  745. You will find details of the video attributes for each of these settings in
  746. the Amiga User Guide.
  747.  
  748. When you save a form on disk, the current resolution setting is saved with
  749. it. When you load the form into memory, the screen will automatically be
  750. set to the same resolution.
  751.  
  752.                 2-11
  753.  
  754.              CHAPTER 3 - DESIGNING A PAGE
  755.  
  756. This chapter explains how to design a page. The term 'design' covers any
  757. and all of these activities:
  758.  
  759. Selecting different types of object to appear on a page.
  760. Adding objects to a page.
  761. Sizing objects.
  762. Positioning objects on page.
  763. Setting an object's attributes - such as its colour and pattern.
  764. Aligning objects with each other.
  765.  
  766. One aspect of designing a page which is not covered here is the option for
  767. defining validations and calculations for fields. These are explained in
  768. Chapter 5.
  769.  
  770. DESIGN TOOLS
  771. You will notice that the Set menu is divided into two groups of options.
  772. The options in the top group are the ones you use to add an object to a
  773. page. We refer to these as design tools. This section describes all the
  774. design tools except Calculation, and Validation (see Chapter 5).
  775.  
  776. OVERVIEW
  777. The procedure for using any of the design tools is essentially the same for
  778. all the options in the Set menu.
  779.  
  780. First select the design tool by pulling down the Set menu and selecting the
  781. appropriate item. Move the pointer (the small crosshairs) to the position
  782. in the forms window where you want to place the object. Now click the left
  783. mouse button to start creating an object.
  784.  
  785. If you have selected one of the graphics options - Line, Box, and Area -
  786. you can now draw the object to the size you require by moving the pointer.
  787. As you do this, the Forms Editor uses a dotted line to show where the
  788. object will appear and how big it will be.
  789.  
  790. When you have decided what you want the object to look like, click the left
  791. mouse button again. The Forms Editor will then draw it on screen according
  792. to the position and dimensions you have selected.
  793.  
  794. If you have selected the Text option, creating an object means typing in
  795. text
  796.  
  797.                 3-1
  798.  
  799. from the keyboard. When you have finished, you can either click the left
  800. mouse button a second time or press the Return key.
  801.  
  802. After you have selected Field, Calculation, or Validation, clicking the
  803. left mouse button will present you with a dialog. Chapter 5 explains how to
  804. proceed from there. The other Set menu option, Image, is covered in a later
  805. section in this chapter.
  806.  
  807. NOTE
  808. If you are familiar with other drawing or design programs, you may find
  809. some of the techniques used here slightly different. With some programs,
  810. you need to keep the mouse button pressed down while you draw a line, for
  811. example. Releasing the button then 'fixes' the line on the screen.
  812.  
  813. With the Forms Editor, things are much easier; you can take your hand away
  814. from the mouse in the middle of creating an object, and you can use the
  815. scroll bar to move the window to another part of the form. This gives you
  816. the chance to examine the picture and decide exactly what dimensions you
  817. want the object to have.
  818.  
  819. CANCELLING AN OPERATION
  820. On the Amiga, you can interrupt an operation by clicking the right mouse
  821. button. With Gem versions of the Forms Editor, once you have selected one
  822. of the graphics design tools - Line, Box, and Area - it is not possible to
  823. cancel the operation halfway through. Once you have started, you must
  824. complete the operation by clicking the mouse button a second time. As a
  825. result, you will sometimes find you have added an object to the page by
  826. mistake.
  827.  
  828. If you want to cancel the effects of the last operation, use the Undo
  829. option from the Edit menu. This removes the object you have just created.
  830. At a later stage, you can still remove any object, using Cut from the Edit
  831. menu.
  832.  
  833. Undo also works with the other design tools. However, with the Text option,
  834. the Forms Editor only creates an object if you type something in. This
  835. means you can cancel the operation by deleting characters and pressing the
  836. Return key. The other design tools - Field, Calculation, and Validation -
  837. bring up dialogs which provide Cancel buttons (so the problem doesn't
  838. arise).
  839.  
  840. SUMMARY
  841. Creating an object is a two click process. Click the left mouse button once
  842.  
  843.                 3-2
  844.  
  845. to start. Create the object - draw it, type it, or in the case of fields
  846. and calculations, select it from a dialog - and then click again to fix it
  847. on the screen. If you change your mind immediately after creating an
  848. object, use the Undo option to remove it from the page.
  849.  
  850. FIELDS
  851. Before you can add a field to a page, you need to open the Superbase file
  852. which the field belongs to. Do this in the same way as you would in
  853. Superbase itself: from the Project menu select the Open File option and
  854. then use the File dialog to select a file.
  855.  
  856. Provided a file is open, you can place any of its fields anywhere on a
  857. page. You can add fields from more than one file to the same page, and you
  858. can repeat the same field as many times as you wish (see the section on
  859. replicating fields further on in this chapter).
  860.  
  861. The procedure for adding a filed to a page is as follows:
  862.  
  863. 1. Select Field from the Set menu.
  864. 2. Set the field's attributes from the fields options dialog (see next
  865.    section), then click on OK.
  866. 3. Position the cursor on the page at the point where the field is to be
  867.    added. Then click the left mouse button.
  868. 4. Select a filed from the Fields dialog and click on OK, or double click
  869.    on the field name. If you want to select a field belonging to another
  870.    open file, you must first click on the upward pointing arrow to the
  871.    right of the File Name Box. This action selects the next open file, and
  872.    displays its name and the field names that belong to it. You can cycle
  873.    through all the open files by repeated clicking on the arrow.
  874. 5. The field will then be added to the page at the point where you placed
  875.    the cursor.
  876.  
  877. FIELD OPTIONS
  878. The fields options dialog is presented when you select Field from the Set
  879. menu. it provides two options governing the way a field is added to a page:
  880. auto field names and auto field borders.
  881.  
  882. If you set the auto field names option, the name of the selected field is
  883. added to the page as a text object in the standard System font. It is
  884. placed at the left of the field box.
  885.  
  886.                 3-3
  887.  
  888. The auto field borders option determines whether the field box is drawn
  889. with or without borders. By default, this option is not set, and the field
  890. box is drawn with a dotted line. When you select auto field borders, the
  891. Forms Editor draws the box with a border using a fixed pattern. If you
  892. print a form or load a form from within Superbase, the field will be shown
  893. with its border; the dotted lines around a field box only appear in the
  894. Forms Editor itself.
  895.  
  896. LINES
  897. The Forms Editor allows you to draw straight lines vertically or
  898. horizontally (but not diagonally).
  899.  
  900. The position of the pointer when you click the left mouse button forms the
  901. starting point for a line. Moving the pointer left, right, up or down,
  902. draws a line in that direction from the starting point. It is not necessary
  903. to move the pointer directly above or directly to the side of the starting
  904. point - the program checks to see if you are closer to the vertical or the
  905. horizontal and draws a vertical or horizontal line accordingly.
  906.  
  907. While you are drawing, the Forms Editor shows a dotted line. When you click
  908. the mouse button for a second time, the Forms Editor draws the line on
  909. screen in the current colour, thickness, and pattern (see the section on
  910. Attributes).
  911.  
  912. BOXES
  913. As with drawing a line, the initial position of the pointer on screen sets
  914. the starting point of a box. You can then draw a box by moving the pointer
  915. in any direction. As you do this, the Forms Editor expands the box to the
  916. new cursor position. In effect, drawing a box involves dragging the
  917. diagonally opposite corner away from the starting point.
  918.  
  919. Once you have settled on a particular size and shape for the box, click the
  920. mouse button again to fix it on the screen. The Forms Editor will then draw
  921. it using the current colour, thickness and pattern.
  922.  
  923. AREAS
  924. An area is a box that is filled with the currently selected pattern in the
  925. current foreground colour. It is drawn in exactly the same way as a box.
  926.  
  927. TEXT
  928. Text objects are created in the same way as any other objects. Select Text
  929. from the Set menu and position the cursor where you want the line of text
  930. to start. Click once and type in your characters. As you do this the
  931. characters are shown
  932.  
  933.                 3-4
  934.  
  935. on screen in the selected colour and style attributes, and in the selected
  936. font. Pressing the mouse button or the Return key completes the operation
  937. and fixes the text on the screen.
  938.  
  939. If you make a mistake while you are typing text in, you can edit it using
  940. the cursor keys together with the Del and Backspace keys. Move the cursor
  941. to the part of the line you wish to correct. Del then deletes the character
  942. to the right of the cursor; Backspace deletes the character to the left.
  943. (You can also edit the text after you have pressed Return - see Editing
  944. Text, Chapter 4.) Note that when you type in text, any characters to the
  945. right are pushed further along the line. In wordprocessing terms, text
  946. entry is always in Insert mode.
  947.  
  948. IMAGES
  949. The Forms Editor allows you to load images created with paint programs into
  950. the form. You could design your company logo with a program such as Gem
  951. Paint or Aegis Images, and incorporate it onto screen forms, which you
  952. could then print out as stationery masters for manual office work.
  953.  
  954. When you want to place an image on the form, it's best to move it into the
  955. current directory before starting work with the Forms Editor.
  956.  
  957. Select Image from the Set menu. Now position the mouse pointer at the place
  958. where you want the top left corner of the image to appear. Double click,
  959. and hold down the mouse button while you drag out the box that is to
  960. contain the image. Make the box larger than the image - it's easy to make a
  961. loaded image smaller, but impossible to make it bigger.
  962.  
  963. When you click to fix the lower right corner of the image box, the Forms
  964. Editor presents you with a list of the current files on the disk, from
  965. which you will choose your image. As there is no way of distinguishing
  966. suitable image files,  the list is not selective. This means that you must
  967. be careful to choose a compatible image file, such as .img for GEM, IFF for
  968. Amiga, and NeoChrome or Degas for Atari.
  969.  
  970. Select the image you want, and click on OK. The Forms Editor loads the
  971. image into the screen. Bear in mind that loading images created in one
  972. resolution into a form that is being created in another will have
  973. unpredictable results. The colours, or the aspect ration, or both, may be
  974. wrong.
  975.  
  976. Sometimes it is necessary to have a deliberate distortion of an image on
  977. the screen in order to produce a correct result on the printer, because of
  978. the difference in the aspect ratios of the two devices. The software leaves
  979. it up to you to arrange things to suit your own configuration, rather than
  980. forcing
  981.  
  982.                 3-5
  983.  
  984. you into an outcome which might not be what you wanted.
  985.  
  986. If you want to clip the image, use the Set Size option. You can only clip
  987. an area that begins at the top left corner - it's not possible to size the
  988. image and leave only the lower left corner, for example. If the results do
  989. not please you, go back to the paint program and change the source image
  990. file.
  991.  
  992. Images take up quite a lot of memory. If you try to load multiple images
  993. into the form, you may run out of memory.
  994.  
  995. ATTRIBUTES
  996. THE ATTRIBUTES WINDOW
  997. Selecting Attributes from the Edit menu opens the Attributes window. When
  998. you first open the window, only the top half is shown. On Gem versions,
  999. clicking on the diamond in the top right-hand corner (bottom right-hand
  1000. corner on the Amiga) opens the window up to its fullest extent; clicking on
  1001. the diamond a second time closes the window to half size. You can also move
  1002. the window to a new position on the screen.
  1003.  
  1004. Once you have set up the window in the way you find most convenient, it can
  1005. be left on screen so that it is always available while you are designing a
  1006. form. Alternatively, you can close the window and then call it up when it
  1007. is needed. The Attributes window enables you to change any of the following
  1008. settings:
  1009.  
  1010. The colour of the drawing pen.
  1011. The background colour.
  1012. The pattern in which lines, boxes and areas are drawn.
  1013. The text style-select Normal or any combination of Italic, Bold, and
  1014.     Underlined.
  1015. The field justification-set a field so that its contents are left or right
  1016.     justified, or centered.
  1017. Read Only-set this for a field or calculation to prevent the user from
  1018.     entering data in the file or calculation.
  1019. The thickness of a line.
  1020. The colour palette-by selecting a different colour from the palette, change
  1021.     any colour on screen instantly.
  1022. The object print status-choose whether any object or group of objects is to
  1023.     be printed or not.
  1024.  
  1025.                 3-6
  1026.  
  1027.               (PICTURE OF ATTRIBUTE SCREEN)
  1028.  
  1029. To set one of these attributes, move the pointer over its box and click
  1030. once. If you have set one of the attributes in the top two lines-to the
  1031. right of the pen/paper selector-it will then be highlighted.
  1032.  
  1033. Note: when you are designing a form, there is no need to worry about
  1034. whether you have selected the right attributes for your objects. An
  1035. object's attributes are not fixed and can be changed at any stage: the
  1036. background and foreground colours, the thickness of a line, text style,
  1037. area pattern-all these can be changed after the object has been drawn.
  1038. Chapter 5 covers this facility in more detail.
  1039.  
  1040. PEN/PAPER SELECTOR
  1041. This option is used to set the foreground or background colour for the next
  1042. object to be drawn. The circle in the middle shows the current foreground
  1043. colour. If you think of the Forms Editor as using a pen to draw objects,
  1044. the foreground colour is the colour that the pen draws in.
  1045.  
  1046. You can change the pen colour by clicking on one of the 16 colours in the
  1047. colour panel. First, though, you need to make sure that you select a colour
  1048. for the pen rather than for the paper. Do this by clicking the mouse button
  1049. while the pointer is inside the circle.
  1050.  
  1051. To change the paper colour (the background colour) click outside the circle
  1052. and then select one of the colours from the panel below.
  1053.  
  1054.                 3-7
  1055.  
  1056. PEN
  1057. There two ways of using colour in the Forms Editor. They are referred to
  1058. here as two colour modes. In Pen mode you can set the pen colour but not
  1059. the paper colour. Any object you create is then drawn in the current pen
  1060. colour against the existing paper colour.
  1061.  
  1062. Pen mode is the default colour mode. If you have selected the other mode,
  1063. Pen and Paper, you can switch back to Pen by clicking in the Pen box.
  1064.  
  1065. PEN AND PAPER
  1066. In this colour mode, both the pen (foreground) colour and the paper
  1067. (background) colour can be selected. The main applications for this mode
  1068. are with text and areas; but you can also use it to draw lines and boxes,
  1069. using an area pattern in two colours (see the section on Area Patterns
  1070. later in this chapter).
  1071.  
  1072. With text, the Pen and Paper colour mode allows you to set the background
  1073. colour for a line or even for each character. With areas, it has the effect
  1074. of filling in the spaces (shown in white in the area pattern panel) in a
  1075. pattern, using the selected paper colour.
  1076.  
  1077. The Pen and Paper colour mode is best illustrated by an example. First
  1078. select Text from the Set menu and then select the Attributes window. The
  1079. next step is to select Pen and Paper mode by clicking in its box. Using the
  1080. Pen/Paper selector, make the pen colour blue and the paper colour red (or
  1081. white and black if you have a monochrome display). If you now click in the
  1082. page window and type something in, you will see that the characters are
  1083. shown in blue, while the background colour for the line is red.
  1084.  
  1085. Note that Pen and Paper only allows you to select the background colour for
  1086. an object, and not for the whole page. By default the paper colour for the
  1087. page is white. On the Amiga, you can change this to another colour using
  1088. the Palette; but with Gem versions it is not possible to alter the paper
  1089. background for the page from within the Forms Editor.
  1090.  
  1091. However, there is an easy way round this problem if you want to print forms
  1092. with a consistent colour or shaded background. Select the solid area
  1093. pattern and draw an area as the first object. If you draw it so that it
  1094. covers the whole page, any future objects can be drawn against this
  1095. background. This technique can also be used to give rectangular blocks of
  1096. objects-say, all the objects in a column-a different background colour.
  1097.  
  1098.                 3-8
  1099.  
  1100. COLOUR PALETTE
  1101. The Colour Palette is used to change the colours of objects on screen after
  1102. they have been drawn. It allows you to assign a different colour to any of
  1103. the 16 colours in the Colour Panel-on the Amiga, this figure varies
  1104. according to the resolution (see Chapter 2). Any object that have been
  1105. drawn in that colour will be instantly shown in the new colour. (The same
  1106. effect can be achieved by changing an object's attributes-see Editing
  1107. Attributes in Chapter 4).
  1108.  
  1109. Some users may find the Colour Palette facility a little confusing. The
  1110. best way to understand it is to think of the Forms editor as providing 16
  1111. pens, each with a different coloured ink. The Colour Palette enables you to
  1112. change the colour of the ink a pen uses. The total number of available
  1113. colours remains the same, but the way they are distributed can be altered.
  1114. If you wanted to, you could assign the same colour to all the pens. All the
  1115. boxes in the Colour Panel would then contain the same colour.
  1116.  
  1117. The procedure for assigning a colour from the Palette is as follows:
  1118.  
  1119. 1. Click on the Colour Palette icon-the Colour Selection dialog will
  1120.    appear.
  1121. 2. Select the colour you want to change by clicking on its box in the
  1122.    right-hand panel.
  1123. 3. Select a different colour from the left-hand panel-the colour in the
  1124.    right-hand panel will then change to the colour you have selected from
  1125.    the left-hand panel.
  1126. 4. Click on the OK gadget.
  1127.  
  1128. You will notice that any objects (or their backgrounds) drawn in the old
  1129. colour are now shown in the colour you have selected. If you want to reset
  1130. objects to their initial colours, click on the Reset gadget in the Colour
  1131. Selection dialog.
  1132.  
  1133. OBJECT PRINT STATUS
  1134. This attribute determines whether an object is printed or not. As you will
  1135. see when you come to print out a form (Chapter 7), you have the option of
  1136. printing all the objects in a form or only certain types of objects. The
  1137. Object Print Status further extends the printing options, and allows you to
  1138. leave out selected objects, irrespective of what type they are.
  1139.  
  1140. When the object print status box is highlighted, any object you select will
  1141. not be printed. The default print status for objects is 'on'; that is, an
  1142. object is
  1143.  
  1144.                 3-9
  1145.  
  1146. printed unless you specify otherwise. If you do not want an object to be
  1147. printed, first select the object by double clicking on it and then make
  1148. sure that the Print Status box is highlighted.
  1149.  
  1150. TEXT STYLES
  1151. These attributes set the style in which characters are printed (on screen
  1152. and on paper). From left to right, they are:
  1153.  
  1154.     Normal    Bold  Underlined  Italic
  1155.  
  1156. When a style has been selected, its box is highlighted. To select a
  1157. particular style click on the appropriate box, and click a second time to
  1158. deselect it. Normal cannot be selected at the same time as one of the other
  1159. styles, but otherwise you can have any combination of text styles. For
  1160. example:
  1161.  
  1162.     Bold and italic
  1163.     Bold and underlined
  1164.     Italic and underlined
  1165.     Bold, italic and underlined
  1166.  
  1167. See also the section on Text fonts, later in this chapter.
  1168.  
  1169. FIELD JUSTIFICATION
  1170. You use this attribute to specify where the contents of a field will be
  1171. placed in the field's box. Field justification only applies when forms are
  1172. used with Superbase files.
  1173.  
  1174. There are three alternatives. Field data can be left or right justified, or
  1175. centered. The justification panel has three compartments. Click in the
  1176. appropriate compartment to set the type of justification you want. Any
  1177. fields you add to a page will take the current justification attribute. If
  1178. you want to change the way a field is justified, first select the field and
  1179. then change the justification in the Attributes box.
  1180.  
  1181. READ ONLY
  1182. The Read Only attribute is represented by the letter R at the right of the
  1183. justification panel. You may want to set this attribute when you are
  1184. designing a form for data entry. It allows you to specify that the field
  1185. you have selected can only be read, and cannot be modified. This means that
  1186. you can use the field to display data from a Superbase file, but you will
  1187. not be able to enter data in the file through this field. The default
  1188. condition is that Read Only is not set, and fields can be both read and
  1189. written to.
  1190.  
  1191.                 3-10
  1192.  
  1193. Read Only can also be set for calculations.
  1194.  
  1195. AREA PATTERNS
  1196. Areas can be drawn in any one of the 16 area patterns shown in the area
  1197. pattern panel. The default pattern is Solid, shown at the top left-hand
  1198. corner of the panel.
  1199.  
  1200. You can select a different pattern by clicking on its box. The box will
  1201. flash to show that it has been selected and any future areas will then be
  1202. drawn in that pattern.
  1203.  
  1204. Lines and boxes are also drawn using the current area pattern. This
  1205. provides you with a variety of different dotted and broken lines to choose
  1206. from. When the Form Editor draws a line, it takes the top line from the
  1207. current area pattern. So, if you want to draw a dotted line select box 4;
  1208. for a dotted line with fewer dots in it, select box 6; and for a broken,
  1209. select box 8.
  1210.  
  1211. The fact that lines (and boxes) can be drawn with the current area pattern
  1212. means that lines can take two colours. You can see this effect if you
  1213. select the Pen and Paper colour mode together with one of the broken or
  1214. dotted line patterns.
  1215.  
  1216. LINE THICKNESS
  1217. Four degrees of line thickness, and two types of line pattern, are
  1218. available from the panel at the bottom of the Attributes window. They
  1219. determine the thickness of both Line objects and Box objects.
  1220.  
  1221. The default line is the one shown in the left-hand box. Click on one of the
  1222. other boxes to select a different thickness or pattern.
  1223.  
  1224. TEXT FONTS
  1225. On Gem versions, text can be displayed in one of three different fonts -
  1226. System,  Swiss and Dutch-and in a range of different point sizes. (The
  1227. Amiga offers a different set of fonts and point sizes.) The point size
  1228. determines how high a character is. There are 72 points to the inch, so a
  1229. capital letter in 36 point type size will be printed half an inch high,
  1230. although it may not be shown in exactly this size on screen.
  1231.  
  1232. Note that although you can alter they style of a text object, you cannot
  1233. change its font and point size once it has been added to the page.
  1234.  
  1235.                 3-11
  1236.  
  1237. CROSSHAIRS
  1238. The Crosshairs option provides a drawing aid rather than a tool for
  1239. creating objects. It allows you to replace the normal drawing cursor by
  1240. crosshairs - that is, two intersecting lines which run horizontally and
  1241. vertically across the page window. Used in conjunction with any of the Set
  1242. menu options, the crosshairs enable you to line up objects with each other.
  1243.  
  1244. Unlike the design tools, the Crosshairs option is selected from the Edit
  1245. menu. The menu item acts as a toggle: click once to select Crosshairs,
  1246. click again to turn it off.
  1247.  
  1248. A line and column counter is provided with the Crosshairs option, allowing
  1249. you to see the precise position of any object on the form.
  1250.  
  1251. If the Align option is not selected, the counter will show line and column
  1252. values in pixels. If Align is switched on, the values will be for
  1253. character-based line and column positions.
  1254.  
  1255. ALIGN
  1256. Like the Crosshairs option, Align is an editing aid rather than a design
  1257. tool. It is used to make sure that objects line up with each other on the
  1258. page.
  1259.  
  1260. Align is either on or off. When it is on, the Forms Editor imposes an
  1261. invisible grid on the page. This ensures that any object you add to a page
  1262. is aligned with the nearest character boundary. The character boundaries
  1263. are worked out according to the standard system font, and form a grid of
  1264. lines across the whole page 240 characters wide by 66 characters deep.
  1265.  
  1266. Align can also be used to line up objects after they have been added to a
  1267. page. First you need to select the objects you want to align (Chapter 4
  1268. explains how to select objects). Clicking on Align will then have the
  1269. effect of shifting the objects so that they lie on or start from the
  1270. nearest character boundaries. The default condition is that Align is off.
  1271. Selecting Align from the Edit menu turns it on, and places a tick next to
  1272. it on the menu; selecting Align again, turn it off.
  1273.  
  1274.                 3-12
  1275.  
  1276. REDUCE
  1277. The Reduce menu option scales down the form, bringing the entire 240 column
  1278. by 62 row form page into view. This is very useful for checking the overall
  1279. layout of the form design.
  1280.  
  1281. The reduced view may not be edited. Most of the menu options are disabled
  1282. when you select Reduce.
  1283.  
  1284. When you are looking at the reduced view, the word Reduce on the Edit menu
  1285. is replaced with the word Normal. If you now select Normal, you are
  1286. returned to the original display.
  1287.  
  1288.                 3-13
  1289.  
  1290.                CHAPTER 4 - EDITING FORMS
  1291.  
  1292. There are two ways in which you can edit a form. First, you can edit
  1293. individual pages, altering the arrangement and appearance of objects on a
  1294. page. Second you can change a form's page order.
  1295.  
  1296. In this chapter, we describe the options provided for editing a form. We
  1297. also introduce two new concepts: the Hierarchy of Objects, and the
  1298. Clipboard.
  1299.  
  1300. HIERARCHY OF OBJECTS
  1301. When you add objects to a page you will notice that some of them are
  1302. superimposed on other objects, and some are placed underneath other
  1303. objects. The explanation is that objects have a hierarchy-or 'order of
  1304. precedence'-that governs which objects are placed on top of these.
  1305.  
  1306. The hierarchy is (from lowest to highest):
  1307.  
  1308.     Areas
  1309.     Boxes
  1310.     Lines
  1311.     Images
  1312.     Text
  1313.     Fields
  1314.  
  1315. The further down the list an object is, the higher the priority it is
  1316. given. Thus, boxes are placed on top of areas, and lines are placed on top
  1317. of boxes. If two objects belong to the same category of object, the most
  1318. recent object is placed on top of the other. Thus if you draw a series of
  1319. overlapping areas, it will look like a pile of papers and the last area
  1320. drawn will appear at the top of the pile.
  1321.  
  1322. One way of thinking about the hierarchy of objects is to imagine that each
  1323. type of object is drawn on a separate sheet of glass. A Forms Editor page
  1324. can then be thought of as six sheets of glass superimposed on each other,
  1325. with the sheet showing areas at the back and the fields sheet at the front.
  1326.  
  1327. There are two reasons why you should try and develop a clear idea of how
  1328. the object hierarchy operates. First, it obviously makes a difference to
  1329. the appearance of a page, and you will need to bear the hierarchy in mind
  1330. as you add new objects. Second, the hierarchy plays a part in determining
  1331. how objects are 'selected' (see the next section).
  1332.  
  1333.                 4-1
  1334.  
  1335. SELECTING OBJECTS
  1336. Some Forms Editor commands only work with objects that have been
  1337. 'preselected'. In other words, you need to select an object or a group of
  1338. objects before carrying out certain operations. These operations are:
  1339.  
  1340.     Cut
  1341.     Copy
  1342.     Replicate
  1343.     Move (with a group of objects)
  1344.     Edit attributes
  1345.     Set print status
  1346.  
  1347. You select an object by positioning the pointer over it and double clicking
  1348. the left mouse button. The Forms Editor will then show that the object has
  1349. been selected by outlining it in black with a broken line.
  1350.  
  1351. To select a group of objects, hold the Shift key down and click once on
  1352. each object in turn. Click on an object again to deselect it from the
  1353. group. If you are selecting a line or a box, you need to place the pointer
  1354. on the line or on one of the sides of the box. To select an area it is
  1355. sufficient to place the pointer anywhere inside the area.
  1356.  
  1357. When you select an object, the Forms Editor follows the object hierarchy
  1358. and if two objects occupy the same space it takes the one on top. You might
  1359. think this would make it difficult to select underlying objects. But it is
  1360. unlikely that you will design a page in which one object is completely
  1361. covered up, so you can usually find a part of the underlying object that is
  1362. not obscured by anything else.
  1363.  
  1364. In order to deselect an object or a group of objects double click on part
  1365. of the page that is not occupied by any object.
  1366.  
  1367. EDITING A PAGE
  1368. Editing a page includes:
  1369.  
  1370.     Rearranging the objects on a page.
  1371.     Moving objects to a new position.
  1372.     Removing objects from the page.
  1373.     Copying objects.
  1374.     Resizing objects.
  1375.  
  1376.                 4-2
  1377.  
  1378. This section describes the page editing options. Cut, Copy, Paste and Undo
  1379. are selected from the Edit menu. Move and Size are on the Set menu. Clear
  1380. is on the Page menu.
  1381.  
  1382. UNDO
  1383. For any operation involving one of the Set menu items, the Undo command
  1384. reverses the effect of the last action you carried out. If, for example,
  1385. your last action was to draw a box, Undo removes the box from the page; if
  1386. you have resized a line, Undo will restore the line to its original length
  1387. and position.
  1388.  
  1389. Undo also works with operations involving groups of objects. So if you have
  1390. Moved several objects together, Undo will return them all to their original
  1391. position.
  1392.  
  1393. Note that Undo only reverses the effect of Set menu actions. It cannot be
  1394. used to remove an object that has been added to the page with the Paste
  1395. option.
  1396.  
  1397. CLEAR
  1398. Clear clears a page, removing all the objects on a page. Use this option
  1399. when you want to discard your page design and start again.
  1400.  
  1401. Once a page has been cleared, it cannot be restored by using Undo. If you
  1402. think you might want to use a page design later, make sure that you save
  1403. the page before clearing it.
  1404.  
  1405. THE CLIPBOARD
  1406. The clipboard is an area on disk that the Forms Editor allocates for
  1407. storing objects temporarily. When you Cut or Copy an object, it is placed
  1408. on the clipboard. This area, then, has two functions. It acts as a trash
  1409. can where you can dispose of unwanted objects, and it also acts as
  1410. temporary stopping place for objects which will be later pasted onto a
  1411. page.
  1412.  
  1413. The clipboard can only hold one object or one selected group of objects at
  1414. a time. If there is already an object on the clipboard, using Cut or Copy
  1415. replaces the existing object (or objects) with a new one.
  1416.  
  1417. CUT
  1418. Cut removes selected objects from the screen and stores them on the
  1419. clipboard. It is used to remove objects from a page permanently, and it can
  1420. also be used in conjunction with Paste to transfer objects to another page.
  1421.  
  1422.                 4-3
  1423.  
  1424. To cut an object (or objects), first select it by double clicking on it,
  1425. then pull down the Edit menu and click on Cut.
  1426.  
  1427. COPY
  1428. Copy works in the same way as Cut, except that it copies a selected objects
  1429. onto the clipboard, and does not remove objects from the page. You can use
  1430. it with Paste to duplicate an object on the page as many times as you like.
  1431. It can also copy objects to other pages.
  1432.  
  1433. Copy is particularly useful when you are creating a form in which rows and
  1434. columns are repeated. Suppose you are building a form for data entry, and
  1435. you want each row to have a box where the user keys in data. With Copy, you
  1436. only need to draw a box on the first row and you can then use Paste to
  1437. repeat it on each successive row.
  1438.  
  1439. PASTE
  1440. Paste takes whatever is on the clipboard-a single object or a group of
  1441. objects - and copies it onto the current page.
  1442.  
  1443. To use Paste, first select it from the Edit menu. A dotted rectangle will
  1444. then appear on screen, showing where the clipboard objects will be pasted.
  1445. By moving the pointer, you can move the rectangle to any position on the
  1446. page. When you have decided where you want to place the clipboard objects,
  1447. click the left mouse button. The Forms Editor will then draw them on the
  1448. page.
  1449.  
  1450. Note that if there are no objects on the clipboard, there will be nothing
  1451. to paste on the page. Paste only works with objects that have been
  1452. previously copied or cut. However it does not remove objects from the
  1453. clipboard, so you can paste the same object as many times as you wish.
  1454.  
  1455. MOVE
  1456. The Move option is used to move any object or group of objects to a new
  1457. position on the page.
  1458.  
  1459. First you need to select the Move option from the Set menu. Then position
  1460. the pointer over an object you wish to move. Click once on the left mouse
  1461. button. At this point the object will be outlines with a broken black line
  1462. to show that it has been selected, and the pointer will change to the arrow
  1463. symbol. You can now move the object to a new position. When you click the
  1464. mouse button again,  the object will be removed from the old position and
  1465. redrawn at the new one.
  1466.  
  1467.                 4-4
  1468.  
  1469. MOVING A GROUP OF OBJECTS
  1470. Move also operates on objects that have been selected by double clicking on
  1471. them. One advantage of using this method is that it allows you to select a
  1472. group of objects (either before or after you select the Move option) and
  1473. then move all the objects in the group at the same time.
  1474.  
  1475. Another advantage is that you can move an object even if the pointer is not
  1476. positioned on top of it. You can place the pointer elsewhere on the page
  1477. and move the object in the same way as with the first method-by clicking
  1478. once and then moving the pointer.
  1479.  
  1480. SIZE
  1481. The Size option is used to change the size of graphics objects-lines,
  1482. boxes, areas and images.
  1483.  
  1484. The procedure for resizing an object is as follows:
  1485.  
  1486. 1. Select Size from the Edit menu.
  1487. 2. Move the pointer over the object and click the left mouse button.
  1488. 3. A dotted outline of the object will appear. Moving the pointer will
  1489.    expand or contract the object from the bottom right-hand corner (or the
  1490.    rightmost point in the case of a line).
  1491. 4. Click the mouse button to fix the object at the new size. The top
  1492.    left-hand corner of an object remains in the same position when you
  1493.    resize it. But you can reflect the object about this point in either the
  1494.    x axis or the y axis or both. This means that you can flip an object
  1495.    over at the same time as making it bigger or smaller.
  1496.  
  1497. EDITING ATTRIBUTES
  1498. After you have drawn an object, you can go back and change any of the
  1499. attributes you have given it. This editing facility applies to text and
  1500. graphics objects alike, to single objects or selected groups of objects,
  1501. and to new pages or pages that have been loaded from disk.
  1502.  
  1503. To change an object's attributes, you first need to select the object. Then
  1504. use the attributes window to set the new attributes: simply click on one of
  1505. the window options-line thickness, colour, pattern, text style (for text),
  1506. etc-and the object will instantly take on the new attribute.
  1507.  
  1508.                 4-5
  1509.  
  1510. To see how straightforward the process is, try this example:
  1511.  
  1512. 1. Select Area from the Edit menu and, without setting any attributes
  1513.    beforehand, draw an area. If you have just loaded the Forms Editor, the
  1514.    area will be drawn in a solid black pattern.
  1515. 2. Select the object you have just drawn by double clicking on it. You can
  1516.    now open the attributes window and start changing the area's attributes.
  1517. 3. Change the area's pattern, simply by clicking on another pattern in the
  1518.    panel.
  1519. 4. Change the foreground colour using the Pen and Paper colour selector.
  1520. 5. Click on the Pen and Paper icon to change the colour using Pen and Paper
  1521.    colour selector.
  1522.  
  1523. EDITING TEXT
  1524. Chapter 3 explains how to use the cursor keys to edit text while you are
  1525. typing it in. In the same way, you can also edit text after it has been
  1526. fixed on the page.
  1527.  
  1528. To use this facility, you first need to select Text from the Set menu. Then
  1529. position the cursor over a lien of text (an existing text object) and click
  1530. once. When you do this, the Forms Editor will draw a dotted line around the
  1531. text line and place the cursor at the front of it. You can now edit the
  1532. line-you can change its characters, delete them, or add new
  1533. characters-using the cursor keys,  the Del key and the Backspace key.
  1534.  
  1535. In allowing you to edit existing objects. Text operates in a different way
  1536. to the other design tools. Unlike Line, Box, Area and Image, the Text
  1537. option does not allow you to superimpose one object over another. You might
  1538. want to do this in order to create a 3D effect with a heading, for example.
  1539. The solution here is to use Copy to copy the text line to the clipboard,
  1540. then use Paste to superimpose it.
  1541.  
  1542. CHANGING PAGES
  1543. The order in which pages are placed in a form is not fixed. You can
  1544. rearrange them in any order you wish. Three options on the Page menu are
  1545. provided for this purpose: To Front, Swap >, and Swap < Using these with
  1546. Erase and Open Page (See Chapter 2) gives you complete control over the way
  1547. pages are put together
  1548.  
  1549.                 4-6
  1550.  
  1551. to make forms.
  1552.  
  1553. TO FRONT
  1554. This option makes the current page the first page in the form. For example,
  1555. if Page 5 is the current page, selecting To front makes it Page 1. The
  1556. previous Page 1 will now become Page 2.
  1557.  
  1558. SWAP >
  1559. This option swaps the current page with the page after it. Thus if Page 1
  1560. is current, it will become Page 2, and Page 2 will become Page 1.
  1561.  
  1562. SWAP <
  1563. This option swaps the current page with the page before it. Page 4, for
  1564. example,  would become Page 3, and vice versa.
  1565.  
  1566. ERASE
  1567. Erase deletes the current page from the form. At the same time, it closes
  1568. up the remaining pages and adjusts their page numbers.
  1569.  
  1570.                 4-7
  1571.  
  1572.          CHAPTER 5 - FORMS, FIELDS AND FILES
  1573.  
  1574. This chapter explains how to design the forms you will use with your
  1575. database files. Field and Calculation are the two options which establish
  1576. links between a Superbase file and a form; Validation and Order work with
  1577. fields and calculations once they have been added to a page; if a form
  1578. contains fields from more than one file, Link can be used to establish
  1579. links between the files. All five options are selected from the Set menu.
  1580.  
  1581. CALCULATION
  1582. Calculations can be regarded as special types of fields. They have the same
  1583. function as calculated fields in a Superbase file (see Chapter 2, Volume
  1584. 1). The differences are that the calculations in a form are not directly
  1585. attached to fields, but stand as objects in their own right; and, unlike
  1586. fields, they are not stored in Superbase files and only exist in a form. In
  1587. every other respect, a calculation can be treated as the same type of
  1588. object as a field.
  1589.  
  1590. To add a calculation to a form, select the Calculation option from the Set
  1591. menu- this option will only be available if a file has been opened. You
  1592. will then be presented with the field options dialog. Set this in the same
  1593. way as for fields.
  1594.  
  1595. Now move the cursor to the position on the page where you wish the
  1596. calculation to be added. When you click the mouse button, the Forms Editor
  1597. will display a dialog for the calculation name. Type in a name for the
  1598. calculation and click on OK.
  1599.  
  1600. The name allows you to refer to the calculation in other calculations. The
  1601. rules for creating calculation names are the same as the rules for variable
  1602. names, as set out in Chapter 2 in the DML Reference Guide. Within the
  1603. limits specified, you can enter any name you like, but it is sensible to
  1604. choose a name which indicates the calculation's purpose. For example, if
  1605. you were defining a calculation to show the total for a column of numeric
  1606. fields, you might name it Subtotal1.
  1607.  
  1608. After entering the name, the next step is to enter a formula for the
  1609. calculation. Superbase will present you with a formula dialog. This is the
  1610. same as the dialog which is used for creating calculation formulas in a
  1611. file definition. See Chapter 2, Volume 1, for a full explanation of how to
  1612. create a formula.
  1613.  
  1614.                 5-1
  1615.  
  1616. The formula you attach to a calculation in a form may refer to fields in
  1617. any of the open files even if they are not shown on the form (at least one
  1618. other field from the same file must be present as an object in the form).
  1619. It may also refer to other calculations. In addition, you can create
  1620. formulas using the system variables NOW and TODAY.
  1621.  
  1622. In the Forms Editor, only the name of the calculation will be shown on the
  1623. page. When the form is used in Superbase, the result of the formula will be
  1624. calculated and displayed in place of the name.
  1625.  
  1626. USING REPORT FUNCTIONS IN CALCULATIONS
  1627. If you are designing a form such as an invoice, which requires a
  1628. transactional structure in which a field (or more probably a group of
  1629. fields) is to be repeated down the page, you are likely to need a way of
  1630. performing calculations, such as totalling, on one or more of the fields.
  1631. Ordinary calculation syntax does not allow you to do this, as each of the
  1632. fields to be totalled has the same name. A calculation like this:
  1633.  
  1634.     amount + amount + amount
  1635.  
  1636. is meaningless.
  1637.  
  1638. The Forms Editor allows you to use the special Report Functions to achieve
  1639. the required results. So to produce a total for a field called Amount which
  1640. occurred perhaps 20 times on a form, all you would have to do is type in a
  1641. calculation like this:
  1642.  
  1643.     SUM Amount
  1644.  
  1645. Notice that the calculation operates on all the replicated occurrences of
  1646. the field that follows it. The keyword can be followed by only one field
  1647. name, and complex expressions are not allowed.
  1648.  
  1649. The other Report functions likewise operate on all the occurrences of the
  1650. fields that they refer to. The Functions are:
  1651.  
  1652.     SUM    MEAN    SD (standard deviation)
  1653.     MAX    MIN    VAR (variance)
  1654.  
  1655. Each of these functions provides a rolling result, which is updated in the
  1656. same way as any other calculation, as you enter or edit data.
  1657.  
  1658. Since the Report Functions are used in calculations which have their own
  1659. names, they can be indirectly used in other calculations on the form.
  1660.  
  1661.                 5-2
  1662.  
  1663. VALIDATION
  1664. The Validation option works in the same way as it does in Superbase
  1665. Professional when it is used in a file definition. It allows you to assign
  1666. a validation formula to a field. The formula sets the limits to what you
  1667. can enter in the field.
  1668.  
  1669. To assign a validation formula to a field, first position the cursor over
  1670. the field. When you select Validation from the Set menu, you will be
  1671. presented with a Validation dialog. You can then create the formula by
  1672. making selections from the dialog. The exact procedure for creating a
  1673. validation formula is explained in Volume 1, Chapter 2.
  1674.  
  1675. REPLICATING FIELDS
  1676. With some applications, you will want to repeat the same field at different
  1677. points on the page. One way of doing this is to repeat the fields selection
  1678. procedure each time you add the field. However, an easier way is to use the
  1679. Replicate option from the Edit menu. This option allows you to repeat a
  1680. field as many times as you wish, in one go.
  1681.  
  1682. First select the field you want to replicate by double clicking on it, and
  1683. then select Replicate. This action calls up a dialog where you can enter
  1684. the number of repetitions required. Type in the number and click on OK.
  1685. Starting from the line below the first occurrence of the field, the Forms
  1686. Editor will then replicate the field the specified number of times.
  1687.  
  1688. Replicate can also be used with calculations.
  1689.  
  1690. SETTING THE FIELD ORDER
  1691. The Order option allows you to define the order in which data is entered
  1692. into fields. You can use it when you are designing forms for data input to
  1693. Superbase files.
  1694.  
  1695. By default the field order is the order in which you add fields to a form.
  1696. For example, if you add a Firstname field before a Lastname field, users
  1697. will be required to type in their first names before typing their last
  1698. names. Using the Order option, you can instruct the Forms Editor only to
  1699. accept data in the order you specify, irrespective of how the fields were
  1700. added to a page and where they are positioned on the page. The field order
  1701. applies to all the fields in a
  1702.  
  1703.                 5-3
  1704.  
  1705. form, so you can also define an order which extends over more than one
  1706. page. When you select Order, you are first presented with a dialog which
  1707. gives you a choice of resetting the current order or leaving it as it is.
  1708. If you select Reset, the fields are numbered from left to right on the same
  1709. line, then line by line, and page by page:
  1710.  
  1711.     FIELD1    FIELD2    FIELD3
  1712.     FIELD4    FIELD5    FIELD6
  1713.     FIELD7    FIELD8    FIELD9
  1714.  
  1715. When you have clicked on OK or Cancel in the dialog, the Forms Editor
  1716. displays the field order on screen using an order number for each field.
  1717. You can now define a new order by clicking in field boxes. The rules for
  1718. setting a field's order number are:
  1719.  
  1720. With your first action, select a field as the current field by clicking in
  1721. it once.
  1722.  
  1723. Thereafter, click once in a field to make it the next field in the order
  1724. sequence. The field you click in then becomes the current field. Click
  1725. twice (but do not double click) to take a field to the top of the list-to
  1726. make it the first field.
  1727.  
  1728. This may seem a little complicated. In practice, though, the procedure is
  1729. straightforward. You first select the field you want to start from;
  1730. clicking once in this field makes it the current field and does not reset
  1731. its order number. Then you define the order for the remaining fields by
  1732. clicking in each field once.
  1733.  
  1734. We can illustrate by taking the field order shown above as an example.
  1735. Suppose the first three fields you clicked on were Field2, Field5, and
  1736. Field9. The new field order would then become:
  1737.  
  1738.     FIELD1    FIELD2    FIELD5
  1739.     FIELD6    FIELD3    FIELD7
  1740.     FIELD8    FIELD9    FIELD4
  1741.  
  1742. After the first click, clicking on a field automatically changes its order
  1743. number and, at the same time, makes it the current field. If you want to
  1744. select a field without changing its number, go back to the Set menu and
  1745. select Order; then click on Cancel and start again.
  1746.  
  1747. Note that even if one field is only slightly higher on the page than
  1748. another,  the Forms Editor will regard it as being on a different line.
  1749. When you reset the field order the field on the higher line will be placed
  1750. before the field on the line below, despite the fact that it may appear to
  1751. be on the same line, 
  1752.  
  1753.                 5-4
  1754.  
  1755. and may be positioned further to the right.
  1756.  
  1757. LINKING FILES
  1758. The Set Link option is used to establish the relationships between the
  1759. files associated with a form, so that Superbase can retrieve the correct
  1760. sets of records when you browse through multiple file forms.
  1761.  
  1762. Link works like a relational query. There must be a point of contact is a
  1763. field which has the same content in both files, such as an account number,
  1764. a part code,  or an invoice number. As in Query, you must set a
  1765. relationship of equality between these two fields, which Superbase can use
  1766. as a way of looking up the right records.
  1767.  
  1768. When your form includes fields from only one file, there is no need to set
  1769. a link. Only when there are two or more files do you need to use the
  1770. option. The Forms Editor will let you save a form that uses multiple files
  1771. without setting links for all the files, but the files will be displayed
  1772. independently.
  1773.  
  1774. USING THE LINK OPTION
  1775. When you select Set Link, the Forms Editor displays a dialog box which you
  1776. use to select the fields to be linked.
  1777.  
  1778. At the top is a file name, with a file selector button next to it. You
  1779. click on this button to cycle through the open files. The fields for each
  1780. file are displayed in the field name panel below the file name.
  1781.  
  1782. Below the field name panel are two selection boxes. These will contain the
  1783. names of the two fields that you link. To the right of the selection boxes
  1784. is a Set button. This is used to confirm the selections.
  1785.  
  1786. A TWO FILE EXAMPLE
  1787. Suppose you have designed a form to show a summary of deposit details for
  1788. each client. You must establish a link between the Deposits file and the
  1789. Clients file. This would take the form of the client's last name, which is
  1790. included in every deposit record. So the link would have this structure:
  1791.  
  1792.     lastname.CLIENTS=lastname.DEPOSITS
  1793.  
  1794. In this case, the Clients file is said to be the Master file in the link,
  1795. as you would normally want to browse through the forms in Client order,
  1796. retrieving a group of deposits for each client. The Deposits file is then
  1797. referred to as the Secondary file in the link.
  1798.  
  1799.                 5-5
  1800.  
  1801. In the Set Link dialog, the message at the top of the panel acts as a
  1802. prompt, so that you can see at a glance which part of the operation you are
  1803. doing. When you first select the option, the message reads "Set master link
  1804. field". The field you click on now will be designated as the link field in
  1805. the master file. In our example, you would first select the Clients file,
  1806. then click on the Lastname field. The Forms Editor would then place
  1807. Lastname in the upper selection box, which has a highlighted pointer next
  1808. to it indicating that it is active. You can change the field in the box by
  1809. clicking on another field. When you're ready, click on Set to confirm your
  1810. selection.
  1811.  
  1812. After you have selected a field for the upper box, the message at the top
  1813. of the dialog changes to "Set secondary link field". You must now select a
  1814. field from the other file, in our example the Lastname field from the
  1815. Deposits file. Notice that once you have selected a field from the master
  1816. file, you cannot select the secondary link field from the same file, as the
  1817. Forms Editor automatically removes it from the list of available files.
  1818.  
  1819. Once you have chosen the two fields that form the link, their names will
  1820. appear in the two selection boxes:
  1821.  
  1822.     Lastname.CLIENTS
  1823.     Lastname.DEPOSITS
  1824.  
  1825. Now you confirm the link by clicking on Set. If there are only two files to
  1826. be linked, you can then exit by clicking on OK. The Forms Editor will store
  1827. the link information with the '.sbv' file, and also in the program file
  1828. that is generated when you create a report form.
  1829.  
  1830. LINKING MORE THAN TWO FILES
  1831. Many applications will use forms which include fields from three or more
  1832. files. There can be only one master file. In every other link, the file
  1833. from which the field name is chosen for the upper selection box is called
  1834. the Primary file; the other file is still called the Secondary file.
  1835.  
  1836. The messages at the top of the dialog box always indicate whether you are
  1837. selecting a field from a master, a primary, or a secondary file. The Forms
  1838. Editor automatically makes the correct set of files available for
  1839. selection, depending on which part of the operation you are performing.
  1840.  
  1841. When you are setting links for more than two files, you must first set the
  1842. master file link. After clicking on Set to confirm your selections, you
  1843. repeat
  1844.  
  1845.                 5-6
  1846.  
  1847. the operation for the next pair of files, and so on until all files have
  1848. been linked up.
  1849.  
  1850. EDITING EXISTING LINKS
  1851. Sometimes you may need to change links that you have already set up. The
  1852. main thing to remember is that changing the link structure at any point
  1853. causes all the subsequent links to be cleared, so you will have to set them
  1854. up again. Clearing the links like this is a necessary precaution against
  1855. ending up with an invalid structure.
  1856.  
  1857. When you select Set Link you will see the Master/Secondary link fields
  1858. displayed, with the upper field pointer highlighted. You can select any
  1859. field to replace the master file link field, or click on Clear to empty the
  1860. selection box. Any action which makes a change clears all the subsequent
  1861. link details. Click on Set to confirm new or existing selections, and to
  1862. move on to the following links. If the current selection box is empty,
  1863. clicking on Set has no effect. If you continue to click on Set, you will
  1864. cycle back through the structure.
  1865.  
  1866. LIMITS OF THE LINKING CAPABILITY
  1867. Although the ability to set links between files provides the system
  1868. designer with a powerful tool for creating applications, there is a limit
  1869. to the complexity of the forms which the data base can handle
  1870. automatically. In particular, you cannot set up forms where a transaction,
  1871. defined as a repeating group of fields in a form, has further transactions
  1872. of its own. In our example, each deposit is a transaction, so each deposit
  1873. may only be linked to another file on a one to one basis-you could look up
  1874. some bank details from the Accounts file, for example.
  1875.  
  1876. But consider an invoicing application where three files are linked
  1877. together: a customers file, an invoices file, and an invoice order lines
  1878. file. Here we can set up links to retrieve the invoices for each customer,
  1879. or the order lines for each invoice, structures which look like this:
  1880.  
  1881.     CUSTOMER DATA            INVOICE DATA
  1882.         Invoice 1 data            Order line 1 data
  1883.         Invoice 2 data            Order line 2 data
  1884.         Invoice 3 data            Order line 3 data
  1885.  
  1886.                 5-7
  1887.  
  1888. However, we cannot set up a form which will automatically retrieve both the
  1889. invoices for each customer and the order lines for each invoice, a
  1890. structure like this:
  1891.  
  1892.     Customer data
  1893.         Invoice 1 data
  1894.             Order line 1.1 data
  1895.             Order line 1.2 data
  1896.         Invoice 2 data
  1897.             Order line 2.1 data
  1898.             Order line 2.2 data
  1899.  
  1900. However, having indicated the restrictions, we must point out that since
  1901. Superbase is a programmable database, anything is possible, and forms of
  1902. far greater complexity than the one above can be set up and processed
  1903. easily by Superbase programs.
  1904.  
  1905. For further information on Forms and how they are used from within the
  1906. database itself, see Chapter 8, Using Forms and Reports, in this Volume.
  1907.  
  1908.                 5-8
  1909.  
  1910.               CHAPTER 6 - PRINTING FORMS
  1911.  
  1912. This chapter explains how to use Print, the Forms Editor's printing
  1913. facility. With this option you can create a 'hard copy' version of a page
  1914. that looks almost exactly the same as it does on the screen. You can also
  1915. specify exactly what is to be included in a printout and what is to be left
  1916. out. If you wish,  you can omit all the objects of a specified type, or you
  1917. can leave out just one or two selected objects of different types.
  1918.  
  1919. The quality of a printed form will depend on the type of printer used. But
  1920. even if you are using a low-cost dot matrix printer, you will still be able
  1921. to print forms that are suitable for most of your business requirements.
  1922. When a laser printer is used, the Forms Editor's output approaches the
  1923. quality of printed material produced by traditional typesetting methods.
  1924.  
  1925. PRINTING A PAGE
  1926. The Print option works with the current Forms Editor page and prints a
  1927. third of the page at a time. Each of the three parts of a page is referred
  1928. to here as a print zone. Remember that a page is 240 characters wide and 66
  1929. lines deep. A print zone is therefore the size of a single A4 sheet of
  1930. paper, 80 characters wide by 66 lines deep.
  1931.  
  1932. The procedure for printing a page is as follows:
  1933.  
  1934. 1. Make sure that your printer is on line.
  1935. 2. Select Print from the Project menu. You will then be presented with a
  1936.    dialog, which allows you to set various print options (see the next
  1937.    section),  including the print zone.
  1938. 3. Set the print options, and click on OK.
  1939.  
  1940. To print a multi-page form or to print more than one print zone in a page,
  1941. you need to repeat this process for each page and each zone.
  1942.  
  1943. PRINT OPTIONS
  1944. The Forms Editor provides two print modes, Draft and Graphics. To select
  1945. one of these two, click on the appropriate box in the Print dialog.
  1946.  
  1947.                 6-1
  1948.  
  1949. DRAFT PRINTING
  1950. In Draft mode, the Forms Editor only prints the text on a page, using the
  1951. printer's standard font. When you are designing a form, you could use this
  1952. mode to get a rough idea of what the page layout looks like.
  1953.  
  1954. There are many circumstances where it is not necessary to print record data
  1955. in 'letter quality' or 'near letter quality' print. But at the same time
  1956. you might want to improve the presentation of the data by using a standard
  1957. form in which it is neatly laid out with boxes, lines, heading, titles, and
  1958. so on. To do this,  would first design your standard form, taking advantage
  1959. of all the Forms Editor's graphics and text facilities; you would also
  1960. specify which fields are to be included on the form.
  1961.  
  1962. The next step is to photocopy or print out multiple copies of the form, and
  1963. feed them back into the printer. If you the use the form in Superbase to
  1964. extract the data, you will be able to print the data on the photocopy of
  1965. the standard form,  in the fields you have specified.
  1966.  
  1967. GRAPHICS PRINTING
  1968. In the Graphic print mode, the Forms Editor produces a hard copy version of
  1969. a page, which matches the appearance of the page on screen. Graphics
  1970. objects are copied to the printer with the same attributes as they have on
  1971. screen (except colour-see below); and text objects are printed in the same
  1972. font, in the same point size and with the same text style.
  1973.  
  1974. In addition, Graphics mode allows you to select which types of object you
  1975. want to print. This means you can omit certain types of objects from the
  1976. printout of a page. For example, you could instruct the Forms Editor to
  1977. leave out fields, or only to print text.
  1978.  
  1979. The print dialog provides a selection box for each of the six types of
  1980. objects. If you want to print an exact copy of the screen, you need to
  1981. click in all the boxes. When you select a particular type of object for
  1982. printing, its box is highlighted; clicking a second time deselects the
  1983. object and turns the highlight off.
  1984.  
  1985. Obviously, you will not be able to represent the colours you see on screen
  1986. on the printer, unless you have a colour printer. Any colours other than
  1987. white are printed as black.
  1988.  
  1989.                 6-2
  1990.  
  1991. PRINT ZONES
  1992. Most applications do not require forms that are wider than 80 columns, so
  1993. generally you will find that you only use the left-hand print zone.
  1994. However, you may want to create a wide form which runs across two or three
  1995. A4 sheets. In this case, you will need to specify which sheet you want
  1996. printed, using the print zone selector in the print options dialog.
  1997.  
  1998. The print zone selector is divided into three compartments. By default, the
  1999. Forms Editor prints the left hand zone. To print the middle zone or the
  2000. right hand zone, slide the box along to the corresponding compartment in
  2001. the print zone dialog.
  2002.  
  2003. OBJECT PRINT STATUS
  2004. The section on Attributes in Chapter 3 explains how to set an object's
  2005. print status. This attribute gives you a further choice over whether an
  2006. object is printed or not. Provided you have selected a type of object for
  2007. printing, the default condition is that all the objects belonging to this
  2008. type are printed. But by setting the object print status you can specify
  2009. that particular objects within an object type are omitted from your hard
  2010. copy version of a page.
  2011.  
  2012.                 6-3
  2013.  
  2014.            CHAPTER 7 - GENERATING REPORTS
  2015.  
  2016. In addition to its functions as a form design package and a screen painting
  2017. tool, the Forms Editor can be used as am effective generator of reports to
  2018. be used with Superbase databases.
  2019.  
  2020. As far as the Forms Editor is concerned, a Report is a special kind of
  2021. form. If you are working on an existing ordinary form, the Forms Editor
  2022. does not allow you to use the Report menu. Only when you select Project New
  2023. or load an existing Report form are the facilities of the Report menu made
  2024. available. This is also true for the Set Function option.
  2025.  
  2026. When you save a Report Form, the Forms Editor creates the usual '.sbv' file
  2027. which holds a definition of the structure and appearance of the form you've
  2028. designed. But as a Report is being created, the Forms Editor creates an
  2029. additional disk file, which is a Superbase program file, extension '.sbp'.
  2030. This is a Superbase program that you can either run unmodified from within
  2031. Superbase, or edit with the Program Editor to add your own special extras.
  2032.  
  2033. OVERVIEW
  2034. First you use Project New to clear the Forms Editor. Then you open a file
  2035. to enable the Report Menu. Then you use the Report menu options to create
  2036. the report structure. Each one generates a box on the screen, which defines
  2037. a section of the report, such as the heading. You just select the fields
  2038. you want and position them as you require, adding text for column and group
  2039. headings and so on. When you've finished you save the form in the usual
  2040. way. To use the report you first load Superbase, then either open the
  2041. report as a form or run the report program.
  2042.  
  2043. A NOTE ON GRAPHICS AND TEXT
  2044. Reports generated with the Forms Editor for use with Superbase are
  2045. straightforward ASCII output. You cannot include areas of colour, patterns,
  2046. or lines, nor can you print out images. Text will always appear in the
  2047. usual system font. (You can vary the colour of the text on screen, but it
  2048. won't print in colour). You can specify that any text item is underlines,
  2049. italic, or boldface, and the report will appear like that provided the
  2050. printer supports the feature.
  2051.  
  2052.                 7-1
  2053.  
  2054. You can of course design the stationery on which the report is to appear
  2055. with the Forms Editor.
  2056.  
  2057. CREATING A REPORT: STEP BY STEP 
  2058. PREPARATION
  2059. Select Project New Form. Open at least one of the files you will be using
  2060. in the report. This enables the options on the Report menu, and the Set
  2061. Function option. It also disables options not available for reports.
  2062.  
  2063. You may need to set up field links if you open and use more than one file.
  2064.  
  2065. SELECTING FIELDS TO BE PRINTED
  2066. Choose the Report Select menu option. The Forms Editor places a box on the
  2067. screen, with the word SELECT at the top. The default dimensions of the box
  2068. are three lines by 240 columns. The 240 column right-hand edge of the box
  2069. can be disregarded, as Superbase will follow the current printer settings
  2070. when actually printing the report.
  2071.  
  2072. Now use Set Field in the normal way to place fields from one or more files
  2073. inside the SELECT box. Use Move or Size to change the position or
  2074. dimensions of a field. The position of a field in the box determines where
  2075. it will be printed on the paper.
  2076.  
  2077. You can also use Set Calculation to place a derived field expression in the
  2078. SELECT box, and Set Text to add specific text messages.
  2079.  
  2080. Whatever you place inside the SELECT Box becomes the body of the report,
  2081. and will be printed out on every repeated line.
  2082.  
  2083. SPECIFYING A REPORT HEADING
  2084. Choose the Report heading menu option. This specifies the text that will be
  2085. printed at the top of every page of the report. The Forms Editor places a
  2086. box at the top of the screen with the word HEADING in the top line. Resize
  2087. the box if you want a larger area.
  2088.  
  2089. Now type in the text you want for the report heading. You are limited to
  2090. the standard system font, and the characters available on the normal
  2091. keyboard. If you want the system date or time to appear in the heading, you
  2092. must treat them as calculations, placing them in the HEADING box with the
  2093. Set Calculation option. The same applies to the page number. The relevant
  2094. system variables,  which should be entered as single keywords, are TODAY,
  2095. NOW, and PG; you can assign
  2096.  
  2097.                 7-2
  2098.  
  2099. the calculations any dummy names, as names are not used in the report.
  2100.  
  2101. The HEADING box should also include any column headings, since reports
  2102. generated from the Forms Editor (as opposed to the Superbase Query
  2103. function) do not use field names as automatic column labels.
  2104.  
  2105. SPECIFYING A REPORT FOOTING
  2106. Choose the Report Footing menu option. This specifies the text that will be
  2107. printed at the foot of each page of the report. The Forms Editor adds a box
  2108. with the word FOOTING in the top line. Extend it if you wish.
  2109.  
  2110. Now add any required text items; you may prefer to place the page number in
  2111. the FOOTING box rather than the HEADING box.
  2112.  
  2113. A report consisting of a heading, a footing, and a line of fields is about
  2114. the simplest type of report there is. You could save your Report Form at
  2115. this stage and use it effectively from within Superbase. But if you want to
  2116. achieve a more elaborate report structure, including subtotals and other
  2117. calculations, you must add further sections to the form before saving it.
  2118.  
  2119. GROUPS
  2120. For a fuller discussion of the concept of groups in a report, see Volume
  2121. One,  chapter 11. A group is essentially a way of providing a structure for
  2122. a report. Reports can have no groups, one group, or many groups. When a
  2123. report has several groups, it helps to think of each one as a level. For
  2124. example, if we were to produce a report of addresses in which a subtotal
  2125. was produced for every change of city, county and country, the report would
  2126. have three levels.
  2127.  
  2128. In the Forms Editor report generator, you can specify any number of report
  2129. groups or levels.
  2130.  
  2131. SPECIFYING A GROUP
  2132. Choose the Group option from the Report menu. The Forms Editor presents you
  2133. with a dialog from which you must select a field name. This will be the
  2134. field on which the report is grouped. When you click on OK, the Forms
  2135. Editor inserts two boxes into the report structure, on either side of the
  2136. SELECT box. These are the BEFORE GROUP box and the AFTER GROUP box. They
  2137. have the same field name in the top line so you can tell at a glance that
  2138. they are related.
  2139.  
  2140.                 7-3
  2141.  
  2142. THE BEFORE GROUP BOX
  2143. The BEFORE GROUP box contains text and data that you want to appear on
  2144. every change of group. You can include field names that do not appear in
  2145. the SELECT box. This is the way to produce reports that follow a
  2146. transactional structure:
  2147.  
  2148.     Customer number, customer name
  2149.         Order number, Order date, Order amount
  2150.         Order number, Order date, Order amount
  2151.     Customer number, customer name
  2152.         Order number, Order date, Order amount
  2153.         Order number, Order date, Order amount
  2154.     Customer number, customer name
  2155.         Order number, Order date, Order amount
  2156.         Order number, Order date, Order amount
  2157.         Order number, Order date, Order amount
  2158.  
  2159. Here, the Customer data is placed in a BEFORE GROUP box for the Customer
  2160. name or account number, and the Transaction data appears as a group of
  2161. fields in the SELECT box.
  2162.  
  2163. THE AFTER GROUP BOX
  2164. In this box you can place the usual text and field data, but you can also
  2165. include special reporting functions to produce subtotals, etc. Every time
  2166. the group changes, the AFTER GROUP box will be acted on.
  2167.  
  2168. If you want to make use of the special reporting functions, you must select
  2169. them with the Set Function menu option, which works in a similar way to the
  2170. Set Field or Calculation options. Select Set Function, then click where you
  2171. want the function to appear. You can only place functions in the AFTER
  2172. GROUP or AFTER REPORT boxes. When the Set function dialog appears, click on
  2173. one of the function buttons. The keyword is copied into the Selection box.
  2174. Now select a field name to follow it. Only select one field - you can't
  2175. have more than one item printed in the same place place. Click on OK, and
  2176. the Forms Editor places a field in the AFTER GROUP box, at the point where
  2177. you clicked. It's up to you to identify what the field is for by, for
  2178. example, typing some text next to it.
  2179.  
  2180. Repeat this operation for each special function you want printed out for
  2181. each group.
  2182.  
  2183. If you want to refer to the contents of the Group field that has just
  2184. registered a change use the GROUP keyword, for example:
  2185.  
  2186.                 7-4
  2187.  
  2188.     LAST GROUP WAS FOR: GROUP
  2189.  
  2190. This should be entered as a calculation with a dummy name.
  2191.  
  2192. MULTIPLE GROUPS
  2193. If your report requires several groups or levels, you must select Report
  2194. Group and set up a BEFORE GROUP and an AFTER GROUP box for each one. The
  2195. Forms Editor automatically inserts each new pair of group boxes on either
  2196. side of the SELECT box. This has the effect of determining the sorting
  2197. order for the report, so you should really set up the groups in order from
  2198. largest to smallest.
  2199.  
  2200. SPECIFYING REPORT FUNCTIONS
  2201. There is a sense in which the report can be treated as a single group. This
  2202. is necessary if you want to obtain totals, etc., for the report as a whole.
  2203.  
  2204. Select the Report Report menu option. The Forms Editor creates two further
  2205. boxes, with the words BEFORE REPORT and AFTER REPORT in their top lines. In
  2206. the BEFORE REPORT box you should place any text you want to appear before
  2207. the report proper starts, such as a note to the reader.
  2208.  
  2209. In the AFTER REPORT box you should place any text items, fields, and
  2210. special Report Functions that you want to appear after all the records for
  2211. the report have been printed. Choose all these items exactly as you would
  2212. do for a Group,  as described above.
  2213.  
  2214. THE REPORT FILTER
  2215. A report filter line is generated automatically when necessary, and placed
  2216. in the Superbase report program, as the WHERE part of the program's SELECT
  2217. statement.
  2218.  
  2219. The WHERE line contains only the information needed to relate files
  2220. together when more than one file has been used in a report. The information
  2221. is taken from the field links that you must set before you can save the
  2222. report form. If only one file has been used, no WHERE line is created.
  2223.  
  2224. When you run the report program from within Superbase itself, the program
  2225. displays a filter dialog, so you can add extra conditions to the
  2226. automatically generated filter line for use at runtime.
  2227.  
  2228. You can easily make these temporary extra conditions permanent by editing
  2229. the report program and saving it, under a separate name if you prefer.
  2230.  
  2231.                 7-5
  2232.  
  2233. SORTING
  2234. A default sorting order for the report is generated automatically when
  2235. necessary. The Forms Editor derives this from the sequence of Groups in the
  2236. report structure, and builds an ORDER line, which is placed in the
  2237. Superbase report program. If no group is specified in the report structure,
  2238. the ORDER line includes the name of the first field in the SELECT box.
  2239.  
  2240. As with the Filter, when you run the report program from within Superbase,
  2241. you will be asked whether you wish to add any extra fields to the ORDER
  2242. line. You might wish to sort within the records by date or amount, without
  2243. actually specifying a group for such fields.
  2244.  
  2245. All the fields used for sorting the report are sorted in ascending order.
  2246. If you wish to change this you can alter the ORDER line when it is
  2247. presented at runtime.
  2248.  
  2249. SAVING THE REPORT FORM
  2250. When you have specified all the elements of the report form, save it in the
  2251. usual way, using Project Save. The Forms Editor generates the two files
  2252. that the system will need to allow you to execute the report or load it
  2253. again into the Forms Editor for modification.
  2254.  
  2255. REFINING YOUR REPORT
  2256. You can add certain extra features to your report to enhance its appearance
  2257. and usefulness.
  2258.  
  2259. TITLE PAGE
  2260. If you want to print a separate title page, select the Page before Report
  2261. option. Anything that is in the BEFORE REPORT box will be printed before
  2262. the report proper begins.
  2263.  
  2264. TOTALS PAGE
  2265. Select the Page before Totals if you want the report to print the report
  2266. totals on a separate page.
  2267.  
  2268. SUMMARY REPORTS
  2269. Select the Summarize option from the Report Options, and the report will
  2270. omit the detail normally printed from the SELECT box.
  2271.  
  2272.                 7-6
  2273.  
  2274. PAGE ON GROUP
  2275. You can force the report to eject a new page after any group. Select this
  2276. option from Report Options, and click on the required fieldname. The Forms
  2277. Editor places the word EJECT in the top line of the relevant AFTER GROUP
  2278. box. This option works as a toggle, so to switch it off go through the
  2279. actions again for the same group.
  2280.  
  2281.                 7-7
  2282.  
  2283.         CHAPTER 8 - USING FORMS AND REPORTS
  2284.  
  2285. Using Superbase forms, you can set up quite complex applications involving
  2286. multiple files, and perform many standard data processing activities
  2287. without having to do any programming.
  2288.  
  2289. Forms are intended to be used in three main ways: for browsing through
  2290. files, for entering data into files, and as structures for reporting.
  2291.  
  2292. Report forms are different from other forms. When you open a report form
  2293. from within the database what you see is not the form but its output. This
  2294. is because a report form is only a way of generating a report program.
  2295. Opening the report form causes Superbase to execute the program.
  2296.  
  2297. There are limits to what can be achieved without programming. You can use
  2298. forms to create and retrieve records, but if you require a very complex
  2299. file structure in which files and records are cross-linked in variable
  2300. ways, you may find that you need to program Superbase to achieve your
  2301. objectives. Even so, the programming language itself is designed to reduce
  2302. the time needed for creating applications, and you can use many of the
  2303. built-in facilities of the forms to speed development up still more.
  2304.  
  2305. OPENING A FORM
  2306. Select the Project Open Form option. Superbase presents you with a list of
  2307. all the forms available in the current directory. Open the one you require
  2308. by double clicking on its name or by clicking on its name and then on OK.
  2309.  
  2310. The act of opening a form opens all the files associated with the form.
  2311. Each file is indexed on its primary index, and the name of the master file
  2312. in the form structure is shown in the window title bar.
  2313.  
  2314. Any files already open that are not required by the form are closed. You
  2315. can reopen a file if you wish provided sufficient memory is available.
  2316.  
  2317. SINGLE FILE FORMS
  2318. A form that includes fields from just one file is easy to understand and
  2319. use. You work with it exactly as you do with the default Form View. All the
  2320. browsing activities selected from the Control Panel function in the same
  2321. way. You can switch to another index at any time to view or look up records
  2322. in a different
  2323.  
  2324.                 8-1
  2325.  
  2326. order. Data entry is the done in the same way, except that the fields shown
  2327. on the form are the only ones available.
  2328.  
  2329. MULTIPLE FILE FORMS
  2330. When the fields on the form are drawn from more than one file, the
  2331. situation is more complex. It's important to understand the relationships
  2332. between the different files, and the assumptions that Superbase makes when
  2333. processing multiple file forms.
  2334.  
  2335. All the files from which one or more fields are on the form are drawn are
  2336. linked together into a logical structure which ensures that records are
  2337. retrieved coherently. This structure is created with the Set Link option in
  2338. the Superbase Forms Editor.
  2339.  
  2340. Every multiple file form has a master file. This is the file whose name is
  2341. displayed in the window title bar, and its index is the first index set up
  2342. for the file. The master file determines the order in which data is
  2343. retrieved when you step through the form using the control panel buttons.
  2344. It is possible to select another file as a temporary master file, but the
  2345. underlying structure remains fixed, unless you change it from within the
  2346. Forms Editor.
  2347.  
  2348. Files which are not the master file are tied into the structure with a
  2349. field link. This works like a relational join in a query. For example, the
  2350. demonstration Clients file could serve as a master file for a form designed
  2351. to show details of several deposits. The Deposits file would be linked to
  2352. it through the Last name field: Lastname.CLIENTS=Lastname.DEPOSITS. Then
  2353. you could step through the Clients records, and Superbase would
  2354. automatically retrieve and display the associated Deposits records.
  2355.  
  2356. If there are more than two files associated with a form, a similar
  2357. relational link must be set up for each one in the Forms Editor so that
  2358. Superbase can retrieve records correctly.
  2359.  
  2360. BROWSING WITH A FORM
  2361. Most of the browsing activities carried out with the control panel buttons
  2362. work in the same way as for the default views. You can select the first,
  2363. last, next, or previous record in the master file by clicking on the
  2364. appropriate button. If there are fields to be found in other files
  2365. Superbase will find and display them automatically. There may sometimes be
  2366. a short delay if the form structure is especially complex with many files
  2367. involved.
  2368.  
  2369. The Fast Forward and Rewind buttons scan through the master file one record
  2370. at a time, retrieving records from other files where necessary. The Pause
  2371. button or
  2372.  
  2373.                 8-2
  2374.  
  2375. the space bar interrupts the process, and the Stop button ends it.
  2376.  
  2377. CURRENT RECORD/PAGE SELECTOR
  2378. The current record button has a dual function. If the form is not
  2379. displayed,  perhaps because you have selected a menu option such as System
  2380. Status File,  which temporarily overwrites the screen display, clicking on
  2381. the current record button simply redisplays the form.
  2382.  
  2383. The button works the same way if your form has only one page. However, if
  2384. you have a multi-page form, the current record button functions as a page
  2385. selector. The button has two triangles, on pointing up and one down.
  2386. Clicking on the left-hand button displays the previous page of the form,
  2387. unless you are already on the first page. Conversely, clicking on the
  2388. right-hand button displays the next page of the form, unless you are
  2389. already on the last page.
  2390.  
  2391. CHANGE INDEX
  2392. If you wish to view the data in a different order from the default, select
  2393. the Project Open Index option and choose the required key field. Superbase
  2394. indicates the change by showing it in the window title bar. The browsing
  2395. controls will now select records from the master file according to the new
  2396. index.
  2397.  
  2398. Records from associated files are still retrieved according to the link
  2399. structure.
  2400.  
  2401. TEMPORARILY CHANGING THE MASTER FILE
  2402. You may wish to view forms in an order determined by a file which is not
  2403. the master file. For example, it is equally valid to browse through
  2404. invoices by invoice number or by customer, but the data for invoices and
  2405. customers would normally be held in separate files.
  2406.  
  2407. You can switch to any of the files used by the form by selecting Project
  2408. Open File. The message in the window title bar shows the name of the opened
  2409. file, and is current index, which you may change if you wish (see above).
  2410.  
  2411. Browsing operations will select records according to the sequence of the
  2412. open file and index, but the records associated with each form will of
  2413. course be retrieved according to the form's logical links.
  2414.  
  2415.                 8-3
  2416.  
  2417. LOOKUP
  2418. You can use the Record Lookup button to retrieve a record in the master
  2419. file,  either the default master file or one you have set as described
  2420. above. The easiest way to think of this is to realize that your lookup will
  2421. be for the index and file named in the window title bar.
  2422.  
  2423. Superbase retrieves the required record, or the one nearest to it in key
  2424. value,  and displays all the associated records according to the form's
  2425. logical links. Note that Lookup overrides the constraints on browsing set
  2426. by Filters (see below).
  2427.  
  2428. FILTERS
  2429. The Filter button calls up a filter dialog for the current file. Filters
  2430. play an important part in browsing. You can set up complex conditions for
  2431. any of the files used by the form, to restrict the display to the set of
  2432. records you wish to view. These conditions can be based on text, date,
  2433. numeric or time values, any type of field, and can include complex
  2434. expressions involving Superbase's DML functions. See Volume One for further
  2435. details of how to set up Filters.
  2436.  
  2437. Each file used by the form can have its own filter. A Filter Command Line
  2438. should not refer to fields in other files, as in the browsing situation
  2439. this always creates an implicit relational join between the files, which
  2440. can cause the system to enter an infinite logical loop while attempting to
  2441. satisfy an impossible condition.
  2442.  
  2443. Normally, Filter Command Lines are not saved, as the presumption is that
  2444. the user will want to be able to enter a variety of search conditions at
  2445. any time. However, you can use the function key facilities to store and set
  2446. Filter Command Lines for any file. This is done with the SELECT WHERE
  2447. command, which creates a filter for the current file. So a typical function
  2448. key line would be:
  2449.  
  2450.     SELECT WHERE FILE "clients" Lastname LIKE "[a-3]*"
  2451.  
  2452. Now all you have to do is press the appropriate function key and the filter
  2453. will be set for that file. For further details see the section on Function
  2454. Keys elsewhere in this volume.
  2455.  
  2456. SWITCHING TO THE DEFAULT VIEWS
  2457. If you wish to use one of Superbase's default views, Record View, Table
  2458. View, or Form View, you may do so without closing the form.
  2459.  
  2460.                 8-4
  2461.  
  2462. Pull down the Set menu and select the view you want. The form display is
  2463. switched off, and the selected view display takes its place. All browsing
  2464. and menu options will operate on the file without reference to the form.
  2465.  
  2466. When you select a view, it will normally be for the file that was acting as
  2467. the master file for the form display. However, it is possible to open a
  2468. file from the Project menu, and work with that instead. The form is not
  2469. affected by this, and when you return to the form the form's master file
  2470. will be automatically reopened.
  2471.  
  2472. RESELECTING THE FORM
  2473. To return to a form from one of the default views, pull down the Set menu
  2474. and select the View option which has a checkmark against it, i.e. the one
  2475. you have been using. This action deselects the option, and redisplays the
  2476. form.
  2477.  
  2478. If you have been browsing through the master file in one of the default
  2479. views,  you will find that the form display now reflects the changed master
  2480. record.
  2481.  
  2482. DATA ENTRY AND EDITING
  2483. When a form is open, the Record menu options apply to the form as a whole
  2484. rather than to a single file. This means that, for example, if your form
  2485. uses fields from several different files, Record Save will create records
  2486. for all those files.
  2487.  
  2488. There are limits to this very powerful capability, in particular to the
  2489. type of form in which there are repeated groups of fields for a file.
  2490. Superbase does not allow such a group of fields to have its own subgroup.
  2491. To permit it would oblige the system to be able to edit and process
  2492. multiple levels of transactions automatically: users with such a
  2493. requirement must be prepared to program it directly.
  2494.  
  2495. This issue is also discussed in the Forms Editor guide, in the section on
  2496. setting links for the form.
  2497.  
  2498. FIELD ENTRY ORDER
  2499. In the Forms Editor you can specify the order in which data can be entered
  2500. into the form. This would allow you, for example, to enter some data in the
  2501. top right- hand corner first, then move down a column of figures in the
  2502. centre of the form,  then finish off in the top left-hand corner-using only
  2503. the Return key at the end of each entry to move from one field to the next.
  2504.  
  2505. Return moves the cursor to the next field in the entry order, Control
  2506. Return
  2507.  
  2508.                 8-5
  2509.  
  2510. (Shift Return on the Amiga) moves the cursor to the previous field in the
  2511. entry order.
  2512.  
  2513. You can override the entry order by positioning the mouse pointer in any
  2514. field and clicking to obtain a cursor. Then entry order will be resumed at
  2515. that point when you press Return or Control Return.
  2516.  
  2517. The entry order can only be changed from within the Forms Editor.
  2518.  
  2519. DATA ENTRY: RECORD NEW
  2520. When you want to enter data into the open form, select the Record New menu
  2521. option. Superbase presents a form with all fields empty, and the cursor
  2522. positioned in the first field specified in the entry order.
  2523.  
  2524. Start entering data. Superbase performs validations and calculations on the
  2525. data as you work, in the same way as for single file data entry done
  2526. without a form.
  2527.  
  2528. You can switch from page to page with the Page Selector button, or follow
  2529. the data entry order, or use the mouse to select any field directly.
  2530.  
  2531. COMMITTING THE FORM: RECORD SAVE
  2532. After you have entered all the required data into the form, you can choose
  2533. any of the three standard ways of saving:
  2534.  
  2535. Alt-S (Amiga S)
  2536. Record Save menu option
  2537. Double click of the mouse (must not be in a field)
  2538. The third option asks you for confirmation before proceeding.
  2539.  
  2540. When Superbase saves data from a form, it uses the structure of the form to
  2541. work out how many records to create, and which files to create them in.
  2542.  
  2543. If your form has fields from only one file, saving the form will create
  2544. only one record. Any fields that are present in the file definition but not
  2545. on the form will be left empty. If such a field is a key field, an entry in
  2546. the appropriate index will be made, consisting of spaces.
  2547.  
  2548. It is up to the form designer to ensure that the act of saving the form
  2549. does not create any validation or required field conflicts for fields that
  2550. do not appear on the form.
  2551.  
  2552. If the form includes fields from multiple files, and each field appears
  2553. only once on the form, saving the form will create one record in each file,
  2554. unless the program detects that the data has not changed or that there is
  2555. no data.
  2556.  
  2557.                 8-6
  2558.  
  2559. If any of the fields on the form appear more than once, saving the form
  2560. will create the same number of records in that field's file as there are
  2561. occurrences of the field. So if you had ten order lines on any invoice
  2562. form, each consisting of the fields Quantity, Description, Price, Discount
  2563. and Total, saving the form would result in ten new records in the order
  2564. lines file.
  2565.  
  2566. The fields saved could include not only those actually visible on the form
  2567. and entered manually, but also fields that do not appear on the form, such
  2568. as a key field generated by a formula to link the orders to the invoice
  2569. header.
  2570.  
  2571. When Superbase has saved all the records required by the form's structure,
  2572. it presents you with another blank form. If you don't want to enter any
  2573. more data, any other action will cancel the data entry process.
  2574.  
  2575. BATCH DATA ENTRY
  2576. The process of saving records for a complex form can take an appreciable
  2577. time,  especially on a floppy disk system. Careful system design can reduce
  2578. this, and by selecting Record Batch you can make use of available RAM to
  2579. cut down the delay between saving a form and starting the next.
  2580.  
  2581. EDITING A FORM
  2582. You do not have to select any menu option to begin editing a form. Simply
  2583. point at the field you wish to alter and click in it.
  2584.  
  2585. When you have finished editing, save the form in one of the ways described
  2586. above. Superbase will only replace records to which you have made changes.
  2587. You can make changes to any of the fields in the form, arriving at the
  2588. field you wish to change either by following the entry order through
  2589. pressing Return or by clicking in the field with the mouse. The Page
  2590. Selector button is also available.
  2591.  
  2592. If you select the Record Edit menu option. Superbase displays the current
  2593. record in the current master file, and any associated records, and places
  2594. the cursor in the first field in the entry order. You would usually only
  2595. use this menu option to be sure of selecting the current record after an
  2596. earlier action had obscured the normal screen display of the form.
  2597.  
  2598. SNAPSHOT DATA ENTRY: RECORD DUPLICATE
  2599. This option allows you to use the data in one form as the basis for
  2600. another,  cutting out the need to retype items that stay the same.
  2601.  
  2602. When you select the Record Duplicate menu option, Superbase creates a copy
  2603. of the data for the current master file.
  2604.  
  2605.                 8-7
  2606.  
  2607. You can now edit the form if you wish, and when you're ready save it.
  2608. Superbase creates new records exactly as for Record New.
  2609.  
  2610. REMOVING FORM DATA: RECORD REMOVE
  2611. This option removes the current record for the current master file, as
  2612. indicated in the window title bar.
  2613.  
  2614. REPORTS
  2615. Report Forms differ from ordinary screen forms by being essentially program
  2616. driven. They are not intended to be viewed or printed as such. Instead of
  2617. seeing the report form, you see its output, either on the screen or the
  2618. printer. Chapter 7 of the Forms Editor Guide covers the use of the Forms
  2619. Editor as a report generator.
  2620.  
  2621. RUNNING A REPORT
  2622. There are two ways of running a report: opening the report form, or
  2623. executing the report program.
  2624.  
  2625. If you simply want the report to run without any further actions, choose
  2626. the Project Open Form option, and then select the report you want. The
  2627. report will execute as soon as it's loaded from disk.
  2628.  
  2629. The other choice is to treat the report like any other program. Select
  2630. Program Open, then the name of the report program you want. It will be in
  2631. the list of Superbase programs in the current directory.
  2632.  
  2633. Once the report program is loaded, you can either run it immediately, or
  2634. use the program editor to examine or modify the report program code. To do
  2635. the latter,  select Program Edit.
  2636.  
  2637. ADDING FILTER CONDITIONS
  2638. The Forms Editor generates a WHERE line in the report program which
  2639. contains the default relational and sorting information derived from the
  2640. report form's internal structure.
  2641.  
  2642. The default relational information is only generated if more than one file
  2643. is used in the report form. It always takes the form
  2644.  
  2645.     WHERE Field1.FILEA=Field2.FILEB ASK
  2646.  
  2647. where the fields contain the information on which a join can be made, such
  2648. as an
  2649.  
  2650.                 8-8
  2651.  
  2652. account number held in both files.
  2653.  
  2654. Access to the default filter is automatically provided when you run the
  2655. report program by the ASK statement at the end of the line.
  2656.  
  2657. When Superbase executes this instruction, it displays the standard Query
  2658. Filter Definition dialog, as obtainable from the Process Query Edit menu
  2659. option.
  2660.  
  2661. You may either click on OK, if you wish to make no changes, or add to the
  2662. Filter Command Line by clicking on fields and entering values and functions
  2663. to build up a more complex set of search conditions.
  2664.  
  2665. It would be unwise to remove the relational join, as Superbase is likely to
  2666. begin outputting extremely repetitive and confusing data, and to continue
  2667. for a very long time (the process won't harm your data).
  2668.  
  2669. Click on OK to call up the Order dialog.
  2670.  
  2671. ADDING ORDER CONDITIONS
  2672. The report generator derives a default sorting order from the groups in the
  2673. report form, or the first field in the SELECT line of the query if there
  2674. are no groups.
  2675.  
  2676. When you run the report, Superbase executes an ORDER line which includes
  2677. the command ASK. This causes the presentation of the Query Order dialog.
  2678.  
  2679. You may add extra fields to the Order line, or change sorting order from
  2680. ascending to descending for any particular field.
  2681.  
  2682. Click on OK to confirm your selections.
  2683.  
  2684. PRINT/DISPLAY OPTION
  2685. Before beginning output, the report program executes an instruction to
  2686. select Screen or Printer as the output device.
  2687.  
  2688. Indicate your preference and click on OK. The report program executes the
  2689. rest of its instructions.
  2690.  
  2691.                 8-9
  2692.  
  2693. MODIFYING A REPORT PROGRAM
  2694. It is quite likely that you will want to make some changes to the way your
  2695. report program executes. The main areas where changes are required are:
  2696.  
  2697. Specifying a fixed output device.
  2698. Specifying a fixed or extra default filter conditions.
  2699. Specifying a fixed or extra default order conditions.
  2700.  
  2701. OUTPUT DEVICE
  2702. The output device is selected with the line:
  2703.  
  2704.     REQUEST "REPORT TO PRINTER?", "", 1A%
  2705.     IF A% THEN PRINT;
  2706.  
  2707. To fix the output device as the printer, remove this line, and add the
  2708. statement TO PRINTER to the end of the report program (before the ENDSELECT
  2709. statement if there is one).
  2710.  
  2711. To fix the output device as the screen, remove the whole line: the default
  2712. output device is the screen.
  2713.  
  2714. To fix the output device as a disk file with the name "tempfile", remove
  2715. the line as above, and add TO FILE "tempfile" to the end of the report
  2716. program (before the ENDSELECT statement if there is one).
  2717.  
  2718. FILTER AND ORDER
  2719. You may want to extend the range of the default options, while keeping the
  2720. ability to add different parameters each time you run the report.
  2721.  
  2722. Edit the report program. Add any conditions you want to the WHERE line,
  2723. removing the ASK command only if you don't want the option to add
  2724. conditions at runtime. Do the same for the ORDER line to change or extend
  2725. the sorting parameters for the report.
  2726.  
  2727. FORMS AND THE PROJECT MENU
  2728. OPEN FIELDS
  2729. Each file has its own open fields list, which is not affected by using a
  2730. form.
  2731.  
  2732. CLOSE FORM
  2733. Use this option to close down the form display, thereby releasing the
  2734. memory
  2735.  
  2736.                 8-10
  2737.  
  2738. being used by the form when it is not displayed. The files used by the form
  2739. remain open, and the form's master file will become the current file,
  2740. unless another file has been opened meanwhile.
  2741.  
  2742. EDIT FILE
  2743. You may select this option to change the characteristics of a file
  2744. definition,  but the action causes the form to be closed.
  2745.  
  2746. REMOVE FILE OR INDEX
  2747. You must close a form if you wish to remove any of the files associated
  2748. with it.
  2749.  
  2750. However, you may remove an index belonging to any of the files used in a
  2751. form. Be careful not to remove an index that is part of the link structure
  2752. of a form.
  2753.  
  2754.                 8-11
  2755.  
  2756. ============================================================================
  2757.      DOCS PROVIDED BY RAP AND -+*+-THE SOUTHERN STAR-+*+- for M.A.A.D.                                                               
  2758. ============================================================================
  2759.